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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T19:16:09+00:00 2026-05-17T19:16:09+00:00

I used setGeometry() to move and size some buttons and a list on a

  • 0

I used setGeometry() to move and size some buttons and a list on a Window.
The problem is that the buttons and list have a certain order and are overlapping strangely. I don’t even want them to overlap and don’t understand why they are overlapping in the first place.

As they are in the code below, the only thing I can click is BtnPlay. The other button isn’t even changing on a mouse over. Depending on how I position them things become click-able.

There was a point where I had the widget created first, furthest to the right, and the widget created last at the origin. Everything worked, which leads me to believe that they are overlapping on an unseen plain, but I don’t understand why or how to fix it.
In addition, When I put a button near the list (the button was on the left side of the list), for some reason the list was no longer click able.
Set geometry allows me to set the top left co-ordinates, the width, and height of the widget. I don’t understand why they would interfere with each other.

 int Gui_Init(int argc, char *argv[])
 {
 QApplication app(argc, argv);
 app.setStyle("plastique");
 QWidget Window;
 Window.resize(800, 600);

 QTrackList = new QListObj(&Window);
 RebuildButton BtnRB(&Window);
 PlayButton BtnPlay(&Window);

 Window.show();
 return app.exec();
 return 0;
 }


 RebuildButton::RebuildButton(QWidget *parent) : QWidget(parent)
 {
 Rebuild = new QPushButton(tr("Rebuild Library"), this);
 Rebuild->setGeometry(400,575,100,25);
 connect(Rebuild, SIGNAL(clicked()), this, SLOT(RebuildLibrary()));
 }


 PlayButton::PlayButton(QWidget *parent) : QWidget(parent)
 {
 PlayBtn = new QPushButton(tr("Play Track"), this);
 PlayBtn->setGeometry(400, 550, 100, 25);
 connect(PlayBtn, SIGNAL(clicked()), this, SLOT(PlayTrack()));
 }

The Constructor for QListObj:

 QListObj::QListObj(QWidget *parent) : QWidget(parent)
 {
 List = new QListWidget(parent);
 List->setGeometry(500,0,300,600);
 new QListWidgetItem(tr("fix it"), List);
 connect(List, SIGNAL(itemSelectionChanged()), this, SLOT(SelectTrack()));
 }
  • 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-17T19:16:10+00:00Added an answer on May 17, 2026 at 7:16 pm

    Your design is a bit unconventional, subclassing QWidget to contain a button, but I suspect your problem may be that you are setting the geometry for the buttons relative to the containing QWidget subclasses (RebuildButton and PlayButton) but not setting the geometry for the RebuildButton and PlayButton widgets themselves.

    When you feel more comfortable with how things work, you may want to redesign a bit and try to separate your gui from your business logic. Create a subclass of QWidget to act as your application window (or use QMainWindow) and use a combination of layout managers to add/layout all of your gui controls in that subclass constructor.

    I would then suggest you make all of your button signal connections to private slots in the window class and from those slots, emit custom signals that trigger business logic to execute elsewhere.

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

Sidebar

Related Questions

Never used a cache like this before. The problem is that I want to
I used MyRecorder sample by QTKit, it records everything but I have a problem
I used to have a code that checks any previous element with a corresponding
I used to have an extension which made it so that when you hover
Used as a scripting language, does Scala have some sort of include directive, or
We used to use SourceSafe, and one thing I liked about it was that
I used SWIG for generating some native JNI function interface for Irrlicht C/C++ 3D
I used the following code to display a rich list. import net.rim.device.api.ui.*; import net.rim.device.api.ui.container.*;
I used the following link to download the latest Xampp in order to install
I used to have flat scripts. The classic HTML+PHP in one file: $result =

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.