![]() We set imageLabel's size policy to ignored, making the users able to scale the image to whatever size they want when the Fit to Window option is turned on. ![]() In the constructor we first create the label and the scroll area. Resize( QGuiApplication ::primaryScreen() - >availableSize() * 3 / 5) ScrollArea - >setBackgroundRole( QPalette ::Dark) ImageLabel - >setSizePolicy( QSizePolicy ::Ignored, QSizePolicy ::Ignored) ImageLabel - >setBackgroundRole( QPalette ::Base) : QMainWindow(parent), imageLabel( new QLabel) ImageViewer ::ImageViewer( QWidget *parent) In turn, scaleImage() uses adjustScrollBar() to preserve the focal point after scaling an image. The zoom slots use scaleImage() to perform the zooming. We use the updateActions() function to update the menu entries when a new image is loaded, or when the Fit to Window option is toggled. We use createActions() and createMenus() when constructing the ImageViewer widget. In addition we create four private functions. We reimplement the constructor, and create several private slots to facilitate the menu entries. The ImageViewer class inherits from QMainWindow. #if defined(QT_PRINTSUPPORT_LIB) & QT_CONFIG(printer) QPrinter printer Void adjustScrollBar( QScrollBar *scrollBar, double factor)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |