Results 1 to 2 of 2

Thread: KXmlGuiWindow + QDockWidget + fullscreen = resize problem on restart

  1. #1
    Join Date
    Aug 2006
    Posts
    163
    Thanks
    12
    Thanked 5 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default KXmlGuiWindow + QDockWidget + fullscreen = resize problem on restart

    This problem occurs with a subclassed KXmlGuiWindow which has a QDockWidget displayed on either it's left or right sides. The central widget is a QTreeView, not that it matters.
    The application autosaves the window positions and sizes. The following behavious only occurs when the application is closed with the dock window displayed and it was maximized:

    When the application restarts, it tries to resize to the fullscreen size, in my case 1650x1080. But in the applications rc file, the main window sizes are reported to be:

    Qt Code:
    1. [MainWindow]
    2. Height 1050=1051
    3. Width 1680=1681
    To copy to clipboard, switch view to plain text mode 

    As you can see, the sizes are off by one pixel. The causes the application to very breifly resize to fullscreen+1, and then it resizes to a very small (default) size. The problem is obviously alleviated somewhat by specifying a suitably large default size, but what one really wants is the application to resize properly. Does anyone know a solution for this problem? As I have specified, it is only caused when the dock widget is displayed: hiding the dock widget causes the application to resize normally upon restart. I have not specifically saved the dock widgets size on shutdown: since it is a child widget of the main window all of it's attributes are saved automatically.

  2. #2
    Join Date
    Aug 2006
    Posts
    163
    Thanks
    12
    Thanked 5 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: KXmlGuiWindow + QDockWidget + fullscreen = resize problem on restart

    Well, I fixed the problem in a totally unexpected way. I designed the widget that I was embedding in QDockWidget in Designer ( it was a simple widget with 4 buttons in it in a QVBoxLayout, with a QHBoxLayout as the widgets layout, with spacers at the extremes of both layouts to keep the buttons centered no matter how large the widget was resized). Wonder of wonders, the resize error went away. I compared the code generated by uic to my code, and there was no obvious differences, but the error went away. I am guessing it was some sort of parenting problem that I failed to see or something similar, but I am just guessing.
    Anyway, the problem was solved, so if anyone comes looking, this may help you.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.