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 7062605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:36:50+00:00 2026-05-28T04:36:50+00:00

Did anyone face a problem of putting buttons (or any other widgets) on the

  • 0

Did anyone face a problem of putting buttons (or any other widgets) on the top of a splitter handle? I’ve tried to get the handle, set its layout and put the controls there, but I got some weird look.

My main goal is to create a selector dialog as depicted below:Dialog example

What I get:
enter image description here

Code:

QDialog dialog = new QDialog();
dialog.setLayout(new QVBoxLayout());
QSplitter splitter = new QSplitter();

splitter.setSizePolicy(new QSizePolicy(QSizePolicy.Policy.MinimumExpanding, QSizePolicy.Policy.Fixed));
splitter.addWidget(new QListWidget());
splitter.addWidget(new QTableWidget());
dialog.layout().addWidget(splitter);

QSplitterHandle h = splitter.handle(1);
h.setFixedWidth(30); // I added this line to show the splitter handle
QVBoxLayout lt = new QVBoxLayout();
lt.setSpacing(0);
lt.setMargin(0);
lt.addWidget(new QPushButton("Hello", dialog));
lt.addWidget(new QPushButton("Good bye", dialog));
h.setLayout(lt);

dialog.show();
  • 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-28T04:36:51+00:00Added an answer on May 28, 2026 at 4:36 am

    This gives better result:

    // h.setFixedWidth(30);
    splitter.setHandleWidth(30);
    

    For better result I’d suggest to subclass QSplitterHandle and reimplement sizeHint(). Look through QSplitterHandle documentation.

    You can change layout setting to get exact button positions.
    For example:

    lt.addStrecth();
    

    To remove “relief”-bar you must subclass from QSplitterHandle and reimplement paintEvent().

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

Sidebar

Related Questions

not sure did anyone ever face this kind of problem. here is my code
Did anyone tried to customize the window in which the quicktime is playing video?
I wonder if anyone tried using Kaazing for client push with Silverlight? How did
I have started using the Three20 project for an iPhone/iPad application. Did anyone face
Did anyone get that to work? I mean, unit testing .Net CF apps on
Did anyone handle such scenario in the code? User is typing something in the
Did anyone set up something like this for himself using the existing node.js REPL?
Did anyone successfully install apgl graph library for python? http://packages.python.org/apgl/ Is there other alternative
did anyone encountered a problem with excel_reader2, that the script got aborted by a
I came accross PetaPoco and decided to give it a try Did anyone come

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.