Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Search the layout of a widget
Forum Updated to NodeBB v4.3 + New Features

Search the layout of a widget

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
16 Posts 2 Posters 2.2k Views 1 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #4

    Then you are doing it from the wrong place.

    Can you explain what exactly you want to achieve with your application ?

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

    B 1 Reply Last reply
    0
    • SGaistS SGaist

      Then you are doing it from the wrong place.

      Can you explain what exactly you want to achieve with your application ?

      B Offline
      B Offline
      bozo6919
      wrote on last edited by bozo6919
      #5

      I have for beginning à QMainWindow.
      I apply to them à QWidget.
      At this QWidget, I apply a QVBoxLayout
      At this QVBoxLayout, I apply a QWidget named ContentPanel.
      What I Want is when my mouse is on a widget named ContentPanel, the layout of this widget remove this widget, I create another QWidget named ContentPanel, and I apply at those ContentPanel a QSplitter.
      I have now 2ContentPanel separated by a QSplitter
      If I selected the other QWidget named ContentPanel, it has to do the same.

      My program has to do this at infinite

      (Sorry for my English again ^^')

      Sorry for my English ^^'

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

        You want to add a new widget each time you hover over any of them ?

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

        B 1 Reply Last reply
        0
        • SGaistS SGaist

          You want to add a new widget each time you hover over any of them ?

          B Offline
          B Offline
          bozo6919
          wrote on last edited by
          #7

          @SGaist Yes, separated by a QSplitter

          Sorry for my English ^^'

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

            Can you explain why ?

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

            B 1 Reply Last reply
            0
            • SGaistS SGaist

              Can you explain why ?

              B Offline
              B Offline
              bozo6919
              wrote on last edited by
              #9

              It's for my job, I'm student

              Sorry for my English ^^'

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

                I meant: why do you want to have new widgets created as soon as you hover over one of them ? Because it means that each time your mouse cursor goes over any of them there's a new one that's going to appear so it can very quickly becomes a mess.

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

                B 1 Reply Last reply
                0
                • SGaistS SGaist

                  I meant: why do you want to have new widgets created as soon as you hover over one of them ? Because it means that each time your mouse cursor goes over any of them there's a new one that's going to appear so it can very quickly becomes a mess.

                  B Offline
                  B Offline
                  bozo6919
                  wrote on last edited by
                  #11

                  I saw this post : https://forum.qt.io/topic/84616/replacing-a-widget-with-another-one-containing-splitter/3
                  I want to do like him, look at this picture :
                  0_1531733100564_parentWidget.png

                  Evert box have to be separated by a splitter. But I don't know how to apply at one box two splitters... :/
                  I know that I can apply container with QVBoxLayout and QWidget but I don't know how to do what I want with that

                  Sorry for my English ^^'

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

                    Ok, click is not the same as hover and definitely less dangerous in terms of accidental widget explosion. What will the "clicked widget" contain ?

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

                    B 1 Reply Last reply
                    1
                    • SGaistS SGaist

                      Ok, click is not the same as hover and definitely less dangerous in terms of accidental widget explosion. What will the "clicked widget" contain ?

                      B Offline
                      B Offline
                      bozo6919
                      wrote on last edited by bozo6919
                      #13

                      Yes ^^
                      The "clicked widget" is a class TabbedWindow
                      But It's the same that QWidget.

                      Sorry for my English ^^'

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

                        Then you have to either implement an event filter to listen to the mouse press event on all of these widgets, or re-implement the mousePressEvent of your TabbedWindow and emit a signal that specify which region was clicked so you can connect to it and add new widgets appropriately.

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

                        B 1 Reply Last reply
                        1
                        • SGaistS SGaist

                          Then you have to either implement an event filter to listen to the mouse press event on all of these widgets, or re-implement the mousePressEvent of your TabbedWindow and emit a signal that specify which region was clicked so you can connect to it and add new widgets appropriately.

                          B Offline
                          B Offline
                          bozo6919
                          wrote on last edited by
                          #15

                          I have already connect buttons and event but I don't know how create splitters between two tabbed window correctly

                          Sorry for my English ^^'

                          1 Reply Last reply
                          0
                          • B Offline
                            B Offline
                            bozo6919
                            wrote on last edited by bozo6919
                            #16

                            I have something but with some bugs too :/

                            I have to save a configuration for example that :
                            0_1531832186870_parentWidget.png
                            How can I do with QSettings for save all these data ? I have this :

                                QSettings settings("settings.ini", QSettings::IniFormat);
                            
                                settings.setValue("MainWindow/geometry", window->saveGeometry());
                                settings.setValue("MainWindow/state", window->saveState());
                                settings.setValue("MainWindow/nbrTabbedWindow", tabbed.size());
                                for (int i = 0; i < tabbed.size(); i += 1) {
                                    QString path = "MainWindow/TabbedWindow/" + QString::number(i);
                            
                                    settings.beginGroup(path.toStdString().c_str());
                                    settings.setValue("splitter/geometry", tabbed[i]->splitter->saveGeometry());
                                    settings.setValue("splitter/state", tabbed[i]->splitter->saveState());
                                    settings.setValue("containerWidget/geometry", tabbed[i]->containerWidget->saveGeometry());
                                    settings.setValue("nbrWindows", tabbed[i]->windows.size());
                                    for (int j = 0; j < tabbed[i]->windows.size(); j += 1) {
                                        QString pathWindowGeo = "/windows" + QString::number(j) + "/geometry";
                                        QString pathWindowSta = "/windows" + QString::number(j) + "/state";
                                        QString pathContentTextGeo = "/contents" + QString::number(j) + "/text/geometry";
                                        QString pathContentTextTxt = "/contents" + QString::number(j) + "/text/text";
                                        QString pathContentWidgetGeo = "/contents" + QString::number(j) + "/widget/geometry";
                                        QString pathContentWidgetSty = "/contents" + QString::number(j) + "/widget/styleSheet";
                            
                                        settings.setValue(pathWindowGeo.toStdString().c_str(), tabbed[i]->windows[j]->saveGeometry());
                                        settings.setValue(pathWindowSta.toStdString().c_str(), tabbed[i]->windows[j]->saveState());
                                        settings.setValue(pathContentTextGeo.toStdString().c_str(), tabbed[i]->contents[j]->text->saveGeometry());
                                        settings.setValue(pathContentTextTxt.toStdString().c_str(), tabbed[i]->contents[j]->text->text());
                                        settings.setValue(pathContentWidgetGeo.toStdString().c_str(), tabbed[i]->contents[j]->widget->saveGeometry());
                                        settings.setValue(pathContentWidgetSty.toStdString().c_str(), tabbed[i]->contents[j]->widget->styleSheet());
                                    }
                                    settings.endGroup();
                                }
                            

                            But There are not other ways more simple?
                            And with my method, I cannot for the moment save splitter's children

                            Sorry for my English ^^'

                            1 Reply Last reply
                            0

                            • Login

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