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. How to emit resize event intentionally?
Forum Updated to NodeBB v4.3 + New Features

How to emit resize event intentionally?

Scheduled Pinned Locked Moved General and Desktop
5 Posts 5 Posters 23.5k 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.
  • D Offline
    D Offline
    darkgaze
    wrote on last edited by
    #1

    I´m in a class that creates all custom widgets. But the main window doesn´t emit the resize at the beginning of the app. I would like to generate the event by hand, or make it happen somehow so it positions the widgets correctly at the beginning.

    How do i do it?. I don´t know the size of the window or anything else, so the Event i emit i don´t know what should be there.

    Thanks.

    1 Reply Last reply
    0
    • podsvirovP Offline
      podsvirovP Offline
      podsvirov
      wrote on last edited by
      #2

      If you are referring to the QMainWindow, it is inherited from the QWidget.
      You can override the void QWidget::resizeEvent(QResizeEvent *event) and send a signal out of it:

      @
      void MyMainWindow::resizeEvent (QResizeEvent *event)
      {
      // My signal
      emit mySizeChanged(event->size());
      }
      @

      1 Reply Last reply
      2
      • B Offline
        B Offline
        brucechidester
        wrote on last edited by
        #3

        Resizing it will sent the event.

        this->resize(this->geometry().width(), this->geometry().height());

        1 Reply Last reply
        0
        • B Offline
          B Offline
          butterface
          wrote on last edited by
          #4

          It does not because it is not resized. What do you want to achieve exactly?

          1 Reply Last reply
          0
          • Z Offline
            Z Offline
            ZeAL0T
            wrote on last edited by
            #5

            Do not cheat yourself. You should use layouts. If you use a QMainWindow the best practice will be to use a QMdiArea for handling internal windows. If you use a simple QWidget, just apply one of the layouts (for example QVBoxLayout) and you will be sure that everything will be look perfect.
            Using signals of resizes for widgets positioning looks very strange.
            If the layouts don't work for it, probably you did something wrong.

            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