Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. ShowMin/ShowMax window not working
Forum Updated to NodeBB v4.3 + New Features

ShowMin/ShowMax window not working

Scheduled Pinned Locked Moved Mobile and Embedded
4 Posts 2 Posters 2.1k 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
    Dcqt
    wrote on last edited by
    #1

    I am trying to show the widgets minimized and maximized states using timer,
    The window is getting minimized but not maximized.

    after minimizing if i click on the task bar its showing in maximized state , but i want it show by itslef instead of a click.

    please help..

    main.cpp
    @
    #include <QtGui/QApplication>
    #include "widget.h"
    Widget *objWidget_ptr;

    int main(int argc, char *argv[])
    {
    QApplication a(argc, argv);
    Widget w;
    objWidget_ptr = &w;
    w.show();

    return a.exec&#40;&#41;;
    

    }

    @

    widget.cpp
    @
    #include "widget.h"
    #include <QTimer>
    #include <QDebug>

    int min = 0;
    extern Widget *objWidget_ptr;
    Widget::Widget(QWidget *parent)
    : QWidget(parent)
    {
    QTimer *timer = new QTimer(this);
    connect(timer, SIGNAL(timeout()), this, SLOT(update()));
    qDebug()<<"timer started ";
    timer->start(4000);
    }

    void Widget::update()
    {
    qDebug()<<"4 sec expipred ";

        if(!min) {
                objWidget_ptr->showMinimized();
                min =1;
                qDebug()<<"showing window in  minimized state";
        }else {
                //objWidget_ptr->resize(500,500);
                 objWidget_ptr->showMaximized();
                min =0;
                qDebug()<<"showing window in  maximized state";
        }
    

    }

    Widget::~Widget()
    {

    }

    @

    widget.h

    @
    #ifndef WIDGET_H
    #define WIDGET_H

    #include <QtGui/QWidget>

    class Widget : public QWidget
    {
    Q_OBJECT

    public:
    Widget(QWidget *parent = 0);
    ~Widget();
    public slots:
    void update();
    };

    #endif // WIDGET_H

    @

    1 Reply Last reply
    0
    • mranger90M Offline
      mranger90M Offline
      mranger90
      wrote on last edited by
      #2

      What version of Qt are you using ?
      I just ran this code with Qt 5.2 on Win7 with MSVC2010 and it behaved as expected.

      1 Reply Last reply
      0
      • D Offline
        D Offline
        Dcqt
        wrote on last edited by
        #3

        I am running on Linux using Qt 5.0.

        my intention is to show some external video after minimizing the Qt UI, as an example i tried this.

        window is getting maximized, but it is not shown , only when i click on the icon its showing.

        do we need to generate any events for showing ..

        1 Reply Last reply
        0
        • mranger90M Offline
          mranger90M Offline
          mranger90
          wrote on last edited by
          #4

          Ok. I can duplicate your problem on ubuntu 13.04 with Qt 5.1.
          The work around is to call activateWindow() after the call to showMaximized().

          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