![]() ![]() We make imageLabel the scroll area's child widget, and we make scrollArea the central widget of the QMainWindow. If we omitted to set the imageLabel's scaledContents property, zooming in would enlarge the QLabel, but leave the pixmap at its original size, exposing the QLabel's background. ![]() We ensure that the label will scale its contents to fill all available space, to enable the image to scale properly when zooming. Otherwise, the default size polizy ( preferred) will make scroll bars appear when the scroll area becomes smaller than the label's minimum size hint. 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. IMAGEVIEWER UPDATEWe 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 It displays information like type, color space, EXIF, MakerNote, IPTC, GPS, and more.Void adjustScrollBar( QScrollBar *scrollBar, double factor) At the right, you’ll see the Inspector panel. And the Strip view mode shows a tiny strip of thumbnails on the top with a viewer area. The List view mode shows the image thumbnail, detailed information, and metadata. The Map layout mode uses Apple Maps with GPS data to provide location information. The viewer displays the image with different view (Icon, Strip, List, Map), sort (name, date, color label, tags), and filter (name, extension, tags) options. The left sidebar displays your folders (including Smart Folders), photo libraries, devices, and mounted volumes. In the case of images you want to enlarge, look at different ways to upscale images without losing quality. With the built-in support of camera models and multi-threading, it can progressively scale high-resolution images. ![]() It supports TIFF, HEIF, TGA, WebP, GIF, and many non-standard, old, and RAW image formats.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |