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. Get size of window with debug when runtime
Forum Updated to NodeBB v4.3 + New Features

Get size of window with debug when runtime

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 240 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.
  • mamskyM Offline
    mamskyM Offline
    mamsky
    wrote on last edited by
    #1

    Re: How to check for window size changes?

    Hai, i'm new here, how do i get the window size while running, sometime i will resize the window and get the window size.

    When i use

    void mywindow::resizeEvent(QResizeEvent *event) {
    qDebug() << "Height : " << height();
    qDebug() << "Width : " << width();
    }
    

    and I only get the initial size

    jsulmJ 1 Reply Last reply
    0
    • mamskyM mamsky

      Re: How to check for window size changes?

      Hai, i'm new here, how do i get the window size while running, sometime i will resize the window and get the window size.

      When i use

      void mywindow::resizeEvent(QResizeEvent *event) {
      qDebug() << "Height : " << height();
      qDebug() << "Width : " << width();
      }
      

      and I only get the initial size

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @mamsky https://doc.qt.io/qt-5/qresizeevent.html#size

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      2
      • mamskyM Offline
        mamskyM Offline
        mamsky
        wrote on last edited by
        #3

        Hai, thanks for help, it solved. This is my latest code

        //mainwindow.h
        protected:
            void resizeEvent (QResizeEvent *e);
        
        //mainwindow.cpp
        #include <QResizeEvent>
        //.
        //.
        void mainwindow::resizeEvent(QResizeEvent *e)
        {
            qDebug() << e->size().width();
            qDebug() << e->size().height();
            qDebug() << e->size();
            QWidget::resizeEvent(e);
        }
        
        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