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. [Solved] how to make a QGraphicsProxyWidget modal
Qt 6.11 is out! See what's new in the release blog

[Solved] how to make a QGraphicsProxyWidget modal

Scheduled Pinned Locked Moved General and Desktop
8 Posts 3 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.
  • E Offline
    E Offline
    epalmero
    wrote on last edited by
    #1

    Dear all:

    I am trying to create a QGraphicsProxyWidget that contain a QTable and a QPushButton. So far all is OK but I have a problem. I need the QGraphicsProxyWidget to block all the input to the QGraphicsScene when I said all the input I mean Mouse and Keyboard input except of course to the QGraphicsProxyWidget itselft.

    Another problem is that I use a QVBoxLayout to layout the Widget inside the QGraphicsProxyWidget I am doing it like this:

    @
    // Create the Objects in the Dialog
    channelSelectionList_ = new TraceOverlayChannelSelectionList(channels, targetChannelId);

    closeButton_ = new QPushButton(tr("&Finish"));
    connect(closeButton_, SIGNAL(clicked()), this, SLOT(finished_()));
    
    // Layout Objects
    QVBoxLayout *layout = new QVBoxLayout;
    layout->addWidget(channelSelectionList_);
    layout->addWidget(closeButton_);
    setLayout(layout);
    

    @

    The problem is that for some reason the QTableView look to big with respect to the space that is need it. Is there a way to make the layout to compute the "real required space for the QTableView"?

    Thanks a lot
    Ernesto

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

      Hi,

      Not really an answer but if you want to have all input blocked why not put your QTableView and its friends in a modal QDialog ?

      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
      • E Offline
        E Offline
        epalmero
        wrote on last edited by
        #3

        Hi:

        I thought that to the problem then is that to do so you need to pass a Parent to the QDialog since QGraphicsScene or QGraphicsItem are not real QWidget then they can't be parent, so you will need to pass one of the views of the QGraphicsScene. I have try that and it work but I find that is not really nice from the software design point of view. Thus why I thougth I can use a QGraphicsProxyWidget embedded in the scene.

        All the best and thanks
        Ernesto

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

          But the QGraphicsView is a widget so you can use it as parent

          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
          • E Offline
            E Offline
            epalmero
            wrote on last edited by
            #5

            That is true but the problem is that a QGraphicsScene can be added in several QGraphicsView. So the question is how can the QGraphicsScene know what is the active view at that time? What I mean is the following:

            Let supporse that the QGraphicsScene is added to 2 different views A and B. And that at the moment I am in View A, how do the QGraphicsScene know that is the view I am working at that moment?

            All the best and thanks
            Ernesto

            1 Reply Last reply
            0
            • A Offline
              A Offline
              Asperamanca
              wrote on last edited by
              #6

              Any user events sent to the Scene and Items is always sent to the GraphicsView first. By reimplementing the events within QGraphicsView, or by adding an event filter, you can track which QGraphicsView is currently being worked on.

              It then depends on your use case whether you react to the event directly within the QGraphicsView, or whether you keep the event logic in Scene and Items.

              1 Reply Last reply
              0
              • E Offline
                E Offline
                epalmero
                wrote on last edited by
                #7

                Thanks a lot for you advice I will keep the logic in the QGraphicsScene since it really does not depend on which view you are but is true that I can know who send the events so is really to do it in the way you propose.

                Do you know how by chance how to solve the QTableView layout problem?

                All the best and thanks
                Ernest

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  Asperamanca
                  wrote on last edited by
                  #8

                  I would post the TableView problem as a separate post. The current title won't make TableView experts take a look. If you do so, please mark this post solved by adding '[Solved]' to the title (edit the first post to do that)

                  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