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

  • SEARCH
  • Home
  • 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 7503271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T21:09:48+00:00 2026-05-29T21:09:48+00:00

Problem: If I pull my app’s toolbar off of the window frame and float

  • 0

Problem: If I pull my app’s toolbar off of the window frame and float it, I can’t dock it again. My window hierarchy is fairly complex, so I’m not sure which part I have to poke with a stick to get it to behave.

My Qt app uses a stackWidget as its central widget. In one of the stack’s contained widgets, I want a toolbar and a graphics view. When I float that toolbar, the graphics view expands to consume the entire screen space and refuses to shrink to allow the toolbar to dock again.

The relevant code is below. I’ve stuck it in a project of its own to see what’s going on, so minus a few extra definitions in the header this should compile:

QVBoxLayout* layout0 = new QVBoxLayout(ui->centralWidget);
stack = new QStackedWidget();
layout0->addWidget(stack);

QWidget* screen1 = new QWidget();
QVBoxLayout* layout1 = new QVBoxLayout(screen1);
QToolButton* tool = new QToolButton();
tool->setIcon(QIcon(":/images/sample.bmp"));
tool->setIconSize(QSize(400,400));
QObject::connect(tool,SIGNAL(clicked()),this,SLOT(onPage2()));
layout1->addWidget(tool);
stack->addWidget(screen1);

QWidget* screen2 = new QWidget();
QVBoxLayout* layout2 = new QVBoxLayout(screen2);
QGraphicsView* gview = new QGraphicsView();
layout2->addWidget(gview);
stack->addWidget(screen2);

QToolBar* toolbar = new QToolBar();
toolbar->addAction("home",this,SLOT(onPage1()));
this->addToolBar(Qt::TopToolBarArea,toolbar);
  • 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-29T21:09:57+00:00Added an answer on May 29, 2026 at 9:09 pm

    For a stack widget, Qt requires that each widget within the stack has enough room to add the toolbar before it’ll let you dock it. Strangely, a layout might fit on the screen before you undock the toolbar or expand the window, but Qt might be unhappy about that size.

    First find your trouble stack. Next, increase the window size, modify the widget layout, and/or alter the size constraints of the sub-widgets within the stack to allow the toolbar to dock.

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

Sidebar

Related Questions

Problem: We have a web app that calls some web services asynchronously (from the
I have a problem getting the NSUserDefaults to pull out on a tab/nav/tableview controller
Here is my full problem so if anyone has any ideas or can offer
I have an app where I pull in tweets with a certain hash tag.
Still wresting with GWT and App Engine, and I have come to this problem:
I'm fairly new to Google App Engine and Python, but I did just release
I have a problem as, I am creating an app as a social networking
The production server that hosts my rails app is being wiped and started again,
I'm trying to create an app for the iPhone where I pull data from
I have a problem! We are working on an iPhone-app and are using git.

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.