Hi people,
I need centralize a image into MdiArea and I don't know do this.
When I load a image to MdiArea, as the image have 75x150px it is displayed
in tiled.
Thanks for any help
Hi people,
I need centralize a image into MdiArea and I don't know do this.
When I load a image to MdiArea, as the image have 75x150px it is displayed
in tiled.
Thanks for any help
How are you loading the image ??
YOu cud subclass MDiarea and override paint function. There you can draw ur pixmap once
This form:
QImage img("logo.jpg");
mdiArea->setBackground(QPixmap::fromImage(img));
setBackground will treat the pixmap as a brush, and so it will be tiled.
You will need to subclass the MdiArea and draw the pixmap in paintEvent urself
Can you send-me a litle example of how do this?
Thanks in advanced.
something like -
Qt Code:
{ QMdiArea::paintEvent(event); // this will cause draw a gray background int x = (geometry().width() - pixmap.width() ) /2; int y = (geometry().height() - pixmap.height() ) /2; painter.drawPixmap(x,y,myPixmap); // draw the pixmap in center, or whatever location u want }To copy to clipboard, switch view to plain text mode
Ok. Thanks for while.
Hello to everybody,
I'm a newbie of c++ and QT and i need to place an image in the center of a QMdiArea. I take your code but... how can I use it into QtCreator form? I tryed to promote a widget but QMdiArea can't be used as base widget , so I tryed to create plugin but it can't be attached (or I didn't be able to do it) to QtCreator widget list (, and more, how can I change the image from there? How can I change your constant in a property or pass it from the upper class using it?
Thanks a lot for your time.
Michele
PS. I'm using 2010.04 QT sdk on Windows
Bookmarks