Results 1 to 7 of 7

Thread: Update GUI

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Wiki edits
    17

    Default Re: Update GUI

    Layouts will not allow overlapping widgets, which is what seems to be happening with your progress bar. Can you show the code that constructs the dock widget layout?
    "We can't solve problems by using the same kind of thinking we used when we created them." -- Einstein
    If you are posting code then please use [code] [/code] tags around it - makes addressing the problem easier.

  2. #2
    Join Date
    Apr 2011
    Posts
    132
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    14

    Default Re: Update GUI

    Qt Code:
    1. void MainView::createDock() {
    2. DEBUGME;
    3. lb_dockIcon = new QLabel;
    4. lb_dockIcon->setMaximumHeight(60);
    5. lb_dockIcon->setMinimumHeight(60);
    6.  
    7. lb_dockIcon->setAlignment(Qt::AlignCenter);
    8. lb_dockLabel = new QLabel;
    9. lb_dockLabel->setAlignment(Qt::AlignCenter);
    10.  
    11. _dockTabs = new QTabWidget;
    12.  
    13. _dockMainWidgetLayout = new QVBoxLayout;
    14.  
    15. _dockMainWidget = new QWidget;
    16. _dockMainWidget->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
    17. _dockMainWidget->setLayout(_dockMainWidgetLayout);
    18.  
    19. _dockWidget = new QDockWidget;
    20. _dockWidget->setContentsMargins(5,0,5,0);
    21. _dockWidget->setWidget(_dockMainWidget);
    22.  
    23. connect(_dockWidget, SIGNAL(visibilityChanged(bool)), this, SLOT(showDock(bool)));
    24.  
    25. _dockMainWidgetLayout->addWidget(lb_dockIcon, Qt::AlignCenter);
    26. _dockMainWidgetLayout->addWidget(lb_dockLabel);
    27. _dockMainWidgetLayout->addWidget(_dockTabs);
    28.  
    29. _dockMainWidgetLayout->setStretchFactor(lb_dockIcon,0);
    30. _dockMainWidgetLayout->setStretchFactor(lb_dockLabel,0);
    31. _dockMainWidgetLayout->setStretchFactor(_dockTabs,1);
    32.  
    33. }
    To copy to clipboard, switch view to plain text mode 

    and this is how I call it to print different data again

    Qt Code:
    1. void MainView::setDockData(IFile *file, bool) {
    2.  
    3. DEBUGME;
    4.  
    5. QPixmap icon(file->FilePixmap());
    6.  
    7. lb_dockIcon->setPixmap(icon);
    8. lb_dockIcon->updateGeometry();
    9.  
    10. QString name = file->FileName();
    11. FileWidget::wordWrap(name, 100, 25);
    12. lb_dockLabel->setText(name);
    13. lb_dockLabel->updateGeometry();
    14.  
    15. _dockTabs->clear();
    16. _dockTabs->show();
    17.  
    18. DockVersions *versions = new DockVersions(this, file);
    19.  
    20. DockAddIn *addIn = new DockAddIn(this, file);
    21. connect(addIn, SIGNAL(setDockTabTitle(int, QString)), this, SLOT(setDockTabTitle(int, QString)));
    22.  
    23. for(int i = 0;i < _dockTabs->count();i++) {
    24. _dockTabs->removeTab(i);
    25. }
    26.  
    27. _dockTabs->addTab(addIn, addIn->windowTitle());
    28. _dockTabs->addTab(versions, versions->windowTitle());
    29.  
    30. versions->display();
    31. addIn->display();
    32.  
    33.  
    34. }
    To copy to clipboard, switch view to plain text mode 

    thanks for looking

  3. #3
    Join Date
    Apr 2011
    Posts
    132
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    14

    Default Re: Update GUI

    any ideas ??

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Wiki edits
    17

    Default Re: Update GUI

    You have not applied a layout to _dockWidget, only to to the dockMainWidget widget you place inside it.

Similar Threads

  1. Replies: 2
    Last Post: 29th September 2010, 17:44
  2. how to use update()?
    By zgulser in forum Qt Programming
    Replies: 0
    Last Post: 6th February 2009, 09:45
  3. Is Update() the right way?
    By td in forum Newbie
    Replies: 1
    Last Post: 5th December 2008, 14:54
  4. update()
    By JeanC in forum Qt Programming
    Replies: 4
    Last Post: 11th February 2008, 16:12
  5. Update a row
    By dragon in forum Newbie
    Replies: 9
    Last Post: 17th January 2006, 17:11

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
  •  
Qt is a trademark of The Qt Company.