4/19/2023 0 Comments Imageviewer gtk![]() ![]() Checking page_size field of adjustment: returns the previous old value after maximization/minimization.A behavior which I think is a long standing GTK+ bug. The allocation for Viewport reports the correct size after "ordinary" resize events, but it reports the previous size after maximize/minimize (I'm listening at both window-state-event and configure-event). Placed an image object inside ScrolledWindow + Viewport: scrolls nice and neat, but the problem is, I don't know the visible size of the "directly visible" part of the ScrolledWindow (nor the encapsulating window or Viewport) get_allocation returns the size of the total image area, that is, the visible part plus the non-visible part (that user can see by scrolling). This is what Comix does! This is terrible, so I stopped doing this in the mid-way. Using a Layout directly, moving Image object around manually, and adding & handling horizontal and vertical scrollbars manually (and of course, handle signals and move()ing of the image inside Layout manually). With correct parameters, this plays well both with expanding and shrinking, and the parent scroll area can do the scrolling depending on the size of QLabel.īut to my surprise, such an elementary thing, if I'm not missing something, is not possible using out-of-the box widgets with GTK+. ![]() I can set the image for a QLabel, and on resize, I can smoothly scale the image (without relying on any 3rd party libraries such as gdkpixbuf) to the new size (it seems it's not possible to get the current size with GTK+ due to some convoluted reasons which clearly don't apply to Qt in order to get the size of the "image arena", Comix gets the total window dimensions, subtracts dimensions of menubar, scrollbar, toolbar and scrollbars in get_visible_area_size if they are visible!). No 3rd party libraries (gdkpixbuf), no need to create a custom widget, no worries. Also, since the window could be resized, I need to scale the image dynamically. Now, in both modes, I need the image are to be scrollable, and in fit-to-X, I need to know the actual size of the "displayed image area" which is actually the directly visible window region. I'm trying to implement an image viewer using GTK+3, and it's supposed to have two modes: ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |