oh, i've run in a little problem: the images seem to only show up after resizing the whole window. i tried to manually resize it (same code like in paintEvent) but that doesn't work
oh, i've run in a little problem: the images seem to only show up after resizing the whole window. i tried to manually resize it (same code like in paintEvent) but that doesn't work
Yes, of course, my bad. If you call setPixmap() before show() is called, recalculate() will calculate the new pixmap based on incorrect width and height of the widget (although it's a bit strange as the showEvent should trigger a resizeEvent). You can reimplement showEvent() and call recalculate() and update() there and everything should be fine. The widget will repaint itself twice, but that's a minor problem as one of the runs will return immediately. If you want to fix it, you should for example assign m_px to m_scaled in setPixmap and set the margins to 0 instead of calling recalculate(). If the size hint of the widget is kept, the image will be fine.
At the moment, i have no idea what update doesQt tells me:
Thats cause i just used the same code in update as for paintEventOriginally Posted by Qt 4.4
You don't implement update, you call it and Qt schedules a paintEvent. You were to implement showEvent() and call recalculate() and update() there.
Qt Code:
recalculate(); update(); }To copy to clipboard, switch view to plain text mode
i'm sorry, i just found functions that expected some parameters, is missed the normal QWidget::update() :-)
In one place where i have two instanced in a tab widget as individual tabs, there is now the problem that after the images load, the widgets resize to nearly the full size of the image rather than to the size of the widget. But except that, it works. Thank you :-)
You probably forgot to apply some of the layouts.
not directly layoutsI felt the power of QSizePolicy:
not the tab widget itself, but the objects that show the images need a policy:hehe, again, thank you very much. As everything works well (and now, the images show up immediatly in the tabWidget instead of needing 7 seconds to load without sizePolicys), i'm very happy that the program is finally finished (my biggest program ever).Qt Code:
To copy to clipboard, switch view to plain text mode
No, certainly Ignored is not needed. If you think you need it, you must have done something Bad. I've been programming Qt for more than 4 years and I never needed to set the size policy to ignored![]()
Hm... then i may be on the wrong path in general when making GUIs.
If you have some time, could you please have a look at what i did to make the gui? The files are here:
Base to the vcs.
The GUI-Files are BinaryViewer.cpp, BinaryViewer.h, ImageViewer.cpp, ImageViewer.h. There are some others, but they have no real GUI but provide a simple Stack that shows the actual GUIs.
Thanks, C167
Bookmarks