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. I want to resize a dialog to the width of a QTableView inside of it....
QtWS25 Last Chance

I want to resize a dialog to the width of a QTableView inside of it....

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 3 Posters 362 Views
  • 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.
  • J Offline
    J Offline
    jdent
    wrote on last edited by
    #1

    I tried this:

        QSize sizeOfTableView = tableView->size();
        QSize sizeOfWindow = this->size();
        resize(sizeOfTableView.width(), sizeOfWindow.height());
    

    it does not work as expected!

    JonBJ M 2 Replies Last reply
    0
    • J jdent

      I tried this:

          QSize sizeOfTableView = tableView->size();
          QSize sizeOfWindow = this->size();
          resize(sizeOfTableView.width(), sizeOfWindow.height());
      

      it does not work as expected!

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @jdent Behaviour may depend on where/when you call this code.

      1 Reply Last reply
      0
      • J jdent

        I tried this:

            QSize sizeOfTableView = tableView->size();
            QSize sizeOfWindow = this->size();
            resize(sizeOfTableView.width(), sizeOfWindow.height());
        

        it does not work as expected!

        M Offline
        M Offline
        mpergand
        wrote on last edited by
        #3

        @jdent
        Show us a screenshot of what you get.

        As I said earlier, the sizes of the inner widgets are valid once the dialog is shown.

        J 1 Reply Last reply
        0
        • M mpergand

          @jdent
          Show us a screenshot of what you get.

          As I said earlier, the sizes of the inner widgets are valid once the dialog is shown.

          J Offline
          J Offline
          jdent
          wrote on last edited by jdent
          #4

          @mpergand ok, how can I capture the moment a dialog is shown??

          In MFC there was a OnInitDialog() method.... nothing similar here? There must be a signal to trap...

          M JonBJ 2 Replies Last reply
          0
          • J jdent

            @mpergand ok, how can I capture the moment a dialog is shown??

            In MFC there was a OnInitDialog() method.... nothing similar here? There must be a signal to trap...

            M Offline
            M Offline
            mpergand
            wrote on last edited by
            #5

            @jdent said in I want to resize a dialog to the width of a QTableView inside of it....:

            how can I capture the moment a dialog is shown??

            What's your use case ?

            1 Reply Last reply
            0
            • J jdent

              @mpergand ok, how can I capture the moment a dialog is shown??

              In MFC there was a OnInitDialog() method.... nothing similar here? There must be a signal to trap...

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by
              #6

              @jdent Answered https://forum.qt.io/topic/115490/cdialog-oninitdialog

              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