Results 1 to 4 of 4

Thread: Remove restore button

  1. #1
    Join Date
    Sep 2006
    Posts
    339
    Thanks
    15
    Thanked 21 Times in 16 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Remove restore button

    Hi guys,
    I have a QMainWindow. In the menuBar 'Edit' I click "show Dock Widget". The dockWidget appears. Now I want to remove the " restore button" just next to "close button". I tried setting the windows flags but was unsuccessful.

    Please help me to remove the restore button displayed on dockWidget.


    Qt Code:
    1. MainWindow::MainWindow(QWidget *parent)
    2. : QMainWindow(parent)
    3. {
    4. QAction* newAct = new QAction(QIcon(":/images/new.png"), QObject::tr("&New"), this);
    5. newAct->setShortcut(QObject::tr("Ctrl+N"));
    6.  
    7. QAction* dockAct = new QAction(QIcon(":/images/cut.png"), QObject::tr("Show Dock Widget"), this);
    8. dockAct->setShortcut(QObject::tr("Ctrl+D"));
    9.  
    10. connect(dockAct, SIGNAL(triggered()), this, SLOT(showDockWidget()));
    11.  
    12. QMenu *fileMenu = menuBar()->addMenu(QObject::tr("&File"));
    13. fileMenu->addAction(newAct);
    14.  
    15. QMenu *editMenu = menuBar()->addMenu(QObject::tr("&Edit"));
    16. editMenu->addAction(dockAct);
    17. }
    18.  
    19. MainWindow::~MainWindow()
    20. {}
    21.  
    22. void MainWindow::showDockWidget()
    23. {
    24. _dock = new QDockWidget(this);
    25. _dock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
    26.  
    27. _dock->setFeatures (QDockWidget::AllDockWidgetFeatures);
    28. _dock->setFloating ( true );
    29.  
    30. QToolButton* btn_1 = new QToolButton();
    31. _dock->setWidget( btn_1 );
    32.  
    33. //setWindowFlags( Qt::WStyle_Customize|Qt::WStyle_Title );
    34.  
    35. _dock->setGeometry( width()/2, height()/2, 100, 30 );
    36. _dock->show();
    37. }
    To copy to clipboard, switch view to plain text mode 

    Thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Remove restore button

    Did you try to set the flags on the _dock object and not on the content?

  3. #3
    Join Date
    Sep 2006
    Posts
    339
    Thanks
    15
    Thanked 21 Times in 16 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Remove restore button

    Quote Originally Posted by wysota View Post
    Did you try to set the flags on the _dock object and not on the content?
    Yes I tried on _dock but it didnt work.
    Qt Code:
    1. _dock->setWindowFlags( Qt::WStyle_Customize|Qt::WStyle_Title );
    To copy to clipboard, switch view to plain text mode 

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Remove restore button

    Qt Code:
    1. _dock->setFeatures(QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetMovable);
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

  5. The following user says thank you to jpn for this useful post:

    vermarajeev (26th June 2007)

Similar Threads

  1. Replies: 6
    Last Post: 21st February 2007, 20:35
  2. Replies: 2
    Last Post: 1st August 2006, 10:23
  3. QSettings again ... how to remove array elements
    By Mike in forum Qt Programming
    Replies: 4
    Last Post: 11th January 2006, 08:58

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.