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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:16:50+00:00 2026-05-26T17:16:50+00:00

I want to create a window with a variable number of custom widgets, each

  • 0

I want to create a window with a variable number of custom widgets, each of the widgets can be a group of some simple objects. Widgets should behave similar to dialog windows: they can be moved anywhere inside the parent window, can overlap etc. However, they can’t be moved out of the window. What would be the most appropriate way to implement something like this with QT3? I tried creating windows/dialogs with the main window as parent, but this way the widgets can be moved out of the window.

  • 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-26T17:16:51+00:00Added an answer on May 26, 2026 at 5:16 pm

    You might be able to make use of the drag-and-drop functionality. That’s the only thing I can think of.

    There is an example that comes with Qt called Fridge Magnets. Basically they created a class called DragWidget which is the host of all the other widgets. In the example they create a slew of QLabels with words on them which the user can drag around to create sentences.

    The main job is to implement the following functions.

    void dragEnterEvent(QDragEnterEvent *event);
    void dragMoveEvent(QDragMoveEvent *event);
    void dropEvent(QDropEvent *event);
    void mousePressEvent(QMouseEvent *event);
    

    This example was introduced with Qt4, but it should give you the idea, the code is here

    Basically, when the mouse is pressed the control under the mouse is hidden, and an image is placed in the drag data. When the user drops it somewhere in the control the example closes the one at the previous location and creates a new QLabel and puts it where the user dropped. You should probably change that to just move your control to that location.

    The example makes use of a few concepts that are a little different than what was available in 3.3, so here is a drag and drop example from 3.3

    The main issue is what to show when the user is dragging around. In the first example, they use a nice trick to build an image of the label, so it really looks like the user is dragging the widget around.

    Obviously, it would be much easier to use the MDI functionality in Qt4, but if that’s not an option, this is the only thing I can think of.

    Hope that helps.

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

Sidebar

Related Questions

Is there some window variable in javascript that I can use or a way
I want to create a draggable and resizable window in JavaScript for cross browser
I want to create an application which main window has canvas (or something where
I want to create a separate thread that runs its own window. Frankly, the
I want to a create dialog box like window before displaying the console window.
I want to make a FIR filter using a window function. I have some
I'm using Python Tkinter and I want to place a variable number of text
I want to create a web page where users can initiate a process, this
I want to create a quick function that will console.log a variable name and
I want to create a class in Java from a classname and an variable

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.