ResetCartStyle("C:/dev/cart/portrait.png") įCart->resetCartStyle("C:/dev/cart/landscape.png") įCart->resetCartStyle("C:/dev/cart/portrait.png") The code is working fine, except on Mac OS X: ![]() Instead of painting/updating manually, just call the setPixmap method, the QLabel should manage itself. Ilya's solution below works fine on Windows, but the problem persists on Mac. Platform - OS X Yosemite, Qt 5.3.1, 32 bit. This problem does not happen when I set the background of the parent widget to something like green and comment out the setAttribute(Qt::WA_TranslucentBackground) part, this happens only with setAttribute(Qt::WA_TranslucentBackground) part. SetStyleSheet("background-color: none ") įLayout->setAlignment(Qt::AlignLeft | Qt:: AlignTop) Ĭonnect(p,SIGNAL(clicked(bool)),this,SLOT(clickedSlot())) įCart->resetCartStyle("/Users/attitude/Desktop/foo.png",400,325) įCart->resetCartStyle("/Users/attitude/Desktop/RnSghvV.png",325,400) M圜artParentWidget.cpp: #include "M圜artParentWidget.hpp" ![]() Void resetCartStyle(QString, int w, int h) Void M圜art::resetCartStyle(QString url, int w, int h) P.drawPixmap(0,0,width(),height(),fPixMap) P.setRenderHint(QPainter::SmoothPixmapTransform) SetAttribute(Qt::WA_TranslucentBackground) įPixMap.load("/Users/attitude/Desktop/RnSghvV.png") M圜art::M圜art(QWidget *parent): QLabel(parent) Then when I switch to 'landscape' mode, it does shift, but the original 'portrait' mode stays back: Problem is, when it toggles, the original imprint stays back, i.e, this is the original pic where it is in 'portrait' mode: There is a button clicking on which, the child widget toggles its dimensions ( resetCartStyle), i.e it goes from portrait to landscape mode and vice versa. I have a parent container ( M圜artParentWidget) with translucent background, inside which I have to draw a child widget ( M圜art) with an image background ( this image is in portrait, this image is in landscape), also drawn with translucent background, and both being QLabels.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |