Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Several small dockable windows or widgets
Forum Updated to NodeBB v4.3 + New Features

Several small dockable windows or widgets

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 344 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    TinTin82
    wrote on last edited by TinTin82
    #1

    Hi,

    I would like to display some small windows or widgets with Qt. Each should stand as a "notepad" for a configured item.
    They should be dynamically generated, and also be erasable by the user at any time. I have attached a picture, as I imagine. Unfortunately, I'm not really sure how to do that with Qt.
    Best regards,
    TinTin
    0_1568139315055_Qt_MehrereKleineMerkzettel.jpg

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      You can use a QScrollArea. Put a QVBoxLayout on the widget you will set on the area. Then you can the widgets you want in there.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • T Offline
        T Offline
        TinTin82
        wrote on last edited by
        #3

        Hi SGaist,

        Thanks for the support.
        The widget itself I'm not sure if I should derive from QWidget, or from QFrame.
        When I am at a QWidget
        setStyleSheet ("border: 3px solid rgb (" 1,1,1 "))
        put, I get boxes for the two labels that I have in my widget, but no box around the entire widget. When I derive from a QFrame, I get all three edges. But I would really only interested in the outside. How can I implement that cleverly?
        QtForumFrage.jpg

        Pl45m4P 1 Reply Last reply
        0
        • T TinTin82

          Hi SGaist,

          Thanks for the support.
          The widget itself I'm not sure if I should derive from QWidget, or from QFrame.
          When I am at a QWidget
          setStyleSheet ("border: 3px solid rgb (" 1,1,1 "))
          put, I get boxes for the two labels that I have in my widget, but no box around the entire widget. When I derive from a QFrame, I get all three edges. But I would really only interested in the outside. How can I implement that cleverly?
          QtForumFrage.jpg

          Pl45m4P Offline
          Pl45m4P Offline
          Pl45m4
          wrote on last edited by Pl45m4
          #4

          @TinTin82 said in Several small dockable windows or widgets:

          The widget itself I'm not sure if I should derive from QWidget, or from QFrame.

          QFrame itself also inherits QWidget.

          It depends how your "notepad"-widgets should look like and what functions they need to provide (Buttons, Events etc.).

          You used the keyword "dockable" :) Have you had a look at QDockWidgets already?
          Then, the right side of your main window would be the docking area. You can (un-)dock or close your notepads and move them around.

          EDIT:

          Your border-problem has to do with stylesheet. If you set border: 3px....[...] as style to your widget without any other specification, all childs and inheriting objects also get this style. This explains the behavior shown above in your comment.

          To set your border only around the parent widget and not around your "Rectangle" / "Edit" labels, you have to set a class / object in your stylesheet, like this:

          QString style("QWidget#YourWidgetObjName{ border: 3px solid rgb(%1,%2,%3)}").arg(QString::number(rgb[0])).arg(QString::number(rgb[1])).arg(QString::number(rgb[2]));
          
          setStyleSheet(style);
          

          If debugging is the process of removing software bugs, then programming must be the process of putting them in.

          ~E. W. Dijkstra

          1 Reply Last reply
          1

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved