Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 322465
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T08:56:29+00:00 2026-05-12T08:56:29+00:00

I have a dock widget, now I want to add a Window menu to

  • 0

I have a dock widget, now I want to add a “Window” menu to show/hide the widget. Easy enough to do with

showPropWinAct = new QAction(tr("&Properties"), this);
showPropWinAct->setStatusTip(tr("Show properties window"));
showPropWinAct->setCheckable(true);
connect(showPropWinAct, SIGNAL(toggled(bool)), propertiesWindow, SLOT(setVisible(bool)));

The problem is when the user clicks the [x] on the widget, the showPropWinAct doesn’t get toggled. How can I listen for this event, and toggle the action properly, without firing off a 2nd setVisible signal (one from the close event presumably, and one from the connect above)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T08:56:29+00:00Added an answer on May 12, 2026 at 8:56 am

    Instead of creating a new action, simply get the action from the QDockWidget itself and use that. It’ll take care of state for you:

    http://qt-project.org/doc/qt-4.8/qdockwidget.html#toggleViewAction

    QAction * QDockWidget::toggleViewAction () const

    “Returns a checkable action that can be used to show or close this dock widget.

    The action’s text is set to the dock widget’s window title.
    “

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a QDialog that contains several dock widgets and one QGraphicsView. The widget
I have a main application window that also implements a dock panel. At the
I have a Dock Panel and I want to set its height depending on
I have a boat dock over some water. I want to render out two
I have a Mono application that should not show on the dock, but will
I have a master form for my website, and I want to dock a
I have a DataGridView with 5 columns, with dock = filled . I want
I seem to have the exact opposite problem than this question on stopping dock
Have a matrix report now that has Position, Hours and Wages for a location
I have two resources Dock and Undock in my View which is a UserControl(Dock.xaml),

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.