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. Unable to restore my Application
Forum Updated to NodeBB v4.3 + New Features

Unable to restore my Application

Scheduled Pinned Locked Moved Unsolved General and Desktop
26 Posts 8 Posters 2.0k Views 3 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
    ELEMENTICY
    wrote on last edited by
    #1

    Hello,I got a problem on creating my own application

    I cant restore my application
    This is how its look like:plz-elp-me-you-pro.png
    its become grey and i cant click it.Please help me.Thanks alot.

    jsulmJ JonBJ 2 Replies Last reply
    0
    • E Offline
      E Offline
      ELEMENTICY
      wrote on last edited by
      #2

      This is a Notepad Application,if you need code.

      CPP:

      #include "editor.h"
      #include "ui_editor.h"
      #include "addnew.h"
      #include <QDesktopServices>
      #include <QUrl>
      #include <QMessageBox>
      #include <QFile>
      #include <QFileDialog>
      #include <QMessageBox>
      #include <QPrinter>
      #include <QPrintDialog>
      #include <QTimer>
      
      Editor::Editor(QWidget *parent) :
          QMainWindow(parent),
          ui(new Ui::Editor)
      {
          ui->setupUi(this);
      
          QString ProjectLocation = "C:";
          filemodel = new QFileSystemModel(this);
          filemodel->setRootPath(ProjectLocation);
      
          ui->fileExplorer->setModel(filemodel);
      }
      
      Editor::~Editor()
      {
          delete ui;
      }
      
      void Editor::on_actionAddNew_triggered()
      {
          AddNew *addnew = new AddNew;
          addnew->show();
      }
      
      void Editor::on_actionDocumentation_triggered()
      {
          QString link="https://bare-docs.github.io/";
          QDesktopServices::openUrl(QUrl(link));
      }
      
      void Editor::on_actionNew_triggered()
      {
          AddNew *addnew = new AddNew;
          addnew->show();
      }
      
      void Editor::on_actionOpen_triggered()
      {
          QString filename = QFileDialog::getOpenFileName(this, "Choose a file" );
          QFile file(filename);
          currentFile = filename;
          if(!file.open(QIODevice::ReadOnly | QFile::Text)){
              QMessageBox::warning(this, "Error", "Unable to Open File: " + file.errorString());
          }
          QTextStream in(&file);
          QString text = in.readAll();
          ui->codingarea->setPlainText(text);
          ui->itemname->setText(filename);
          file.close();
      }
      

      .H

      #ifndef EDITOR_H
      #define EDITOR_H
      
      #include <QMainWindow>
      #include <QFileSystemModel>
      #include "qregexhighlighter.h"
      #include <QFile>
      #include <QFileDialog>
      #include <QMessageBox>
      #include <QPrinter>
      #include <QPrintDialog>
      
      namespace Ui {
      class Editor;
      }
      
      class Editor : public QMainWindow
      {
          Q_OBJECT
      
      public:
          explicit Editor(QWidget *parent = nullptr);
          ~Editor();
      
      private slots:
          void on_actionAddNew_triggered();
      
          void on_actionDocumentation_triggered();
      
          void on_actionNew_triggered();
      
          void on_actionOpen_triggered();
      
      private:
          Ui::Editor *ui;
          QFileSystemModel *filemodel;
          QString currentFile = "";
      };
      
      #endif // EDITOR_H
      
      
      1 Reply Last reply
      0
      • E ELEMENTICY

        Hello,I got a problem on creating my own application

        I cant restore my application
        This is how its look like:plz-elp-me-you-pro.png
        its become grey and i cant click it.Please help me.Thanks alot.

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

        @ELEMENTICY said in Unable to restore my Application:

        I cant restore my application

        Restore from what?
        Please explain better what you are doing.

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

        E 1 Reply Last reply
        1
        • jsulmJ jsulm

          @ELEMENTICY said in Unable to restore my Application:

          I cant restore my application

          Restore from what?
          Please explain better what you are doing.

          E Offline
          E Offline
          ELEMENTICY
          wrote on last edited by ELEMENTICY
          #4

          @jsulm i cant click the restore button,
          alt text
          the middle button,between the "_" and "X" button.

          jsulmJ JKSHJ 2 Replies Last reply
          0
          • E ELEMENTICY

            @jsulm i cant click the restore button,
            alt text
            the middle button,between the "_" and "X" button.

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

            @ELEMENTICY It's not "restoring", it's resizing. Do you set fixed size for your application window?

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

            E 1 Reply Last reply
            2
            • jsulmJ jsulm

              @ELEMENTICY It's not "restoring", it's resizing. Do you set fixed size for your application window?

              E Offline
              E Offline
              ELEMENTICY
              wrote on last edited by
              #6

              @jsulm No i didt

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

                Hi,

                Did you tweak any flags in designer with regards to these buttons ?

                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 ELEMENTICY

                  @jsulm i cant click the restore button,
                  alt text
                  the middle button,between the "_" and "X" button.

                  JKSHJ Offline
                  JKSHJ Offline
                  JKSH
                  Moderators
                  wrote on last edited by
                  #8

                  @ELEMENTICY said in Unable to restore my Application:

                  i cant click the restore button,
                  alt text
                  the middle button,between the "_" and "X" button.

                  How did you maximize your window in the first place?

                  @jsulm said in Unable to restore my Application:

                  @ELEMENTICY It's not "restoring", it's resizing.

                  To be fair, that's Windows terminology. If you hover your mouse cursor over the button between "Minimize" and "Close", the tooltip says either "Maximize" or "Restore Down"

                  Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                  E 1 Reply Last reply
                  1
                  • E ELEMENTICY

                    Hello,I got a problem on creating my own application

                    I cant restore my application
                    This is how its look like:plz-elp-me-you-pro.png
                    its become grey and i cant click it.Please help me.Thanks alot.

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

                    @ELEMENTICY
                    If you're not sure how this came about. Start with a 10-line program which just creates a top-level QWidget or QMainWindow. Make sure that does allow "Restore". Then put in what you might have in your real app, like any flags you put on the window.

                    1 Reply Last reply
                    3
                    • Thank YouT Offline
                      Thank YouT Offline
                      Thank You
                      wrote on last edited by Thank You
                      #10

                      Are you sure it is not QDialog?? If it is Qdialog then it will show like this.
                      Just see your UI file

                      Let's make QT free or It will go forever

                      TRUE AND FALSE <3

                      E 1 Reply Last reply
                      3
                      • Thank YouT Thank You

                        Are you sure it is not QDialog?? If it is Qdialog then it will show like this.
                        Just see your UI file

                        E Offline
                        E Offline
                        ELEMENTICY
                        wrote on last edited by
                        #11

                        @Thank-You its mainwindows

                        Pl45m4P 1 Reply Last reply
                        0
                        • E ELEMENTICY

                          @Thank-You its mainwindows

                          Pl45m4P Offline
                          Pl45m4P Offline
                          Pl45m4
                          wrote on last edited by Pl45m4
                          #12

                          @ELEMENTICY said in Unable to restore my Application:

                          its mainwindow

                          Then you must have changed something. QMainWindow is resizable, minimizable and restorable by defaut.
                          Do what @JonB suggested. Create a new, empty project and open the MainWindow.

                          What kind of window do we see in your screenshot? Are you sure, that it is your MainWindow? Because you create some QDialogs and QMessageBoxes here:

                          @ELEMENTICY said in Unable to restore my Application:

                          void Editor::on_actionNew_triggered()
                          {
                          AddNew *addnew = new AddNew;
                          addnew->show();
                          }

                          and here:

                          @ELEMENTICY said in Unable to restore my Application:

                          void Editor::on_actionOpen_triggered()
                          {
                          QString filename = QFileDialog::getOpenFileName(this, "Choose a file" );
                          QFile file(filename);
                          currentFile = filename;
                          if(!file.open(QIODevice::ReadOnly | QFile::Text)){
                          QMessageBox::warning(this, "Error", "Unable to Open File: " + file.errorString());
                          }
                          QTextStream in(&file);
                          QString text = in.readAll();
                          ui->codingarea->setPlainText(text);
                          ui->itemname->setText(filename);
                          file.close();
                          }

                          You don't show us the titlebar of your AddNew dialog(?) or your QFileDialog, don't you? :-)


                          If debugging is the process of removing software bugs, then programming must be the process of putting them in.

                          ~E. W. Dijkstra

                          E 1 Reply Last reply
                          0
                          • Pl45m4P Pl45m4

                            @ELEMENTICY said in Unable to restore my Application:

                            its mainwindow

                            Then you must have changed something. QMainWindow is resizable, minimizable and restorable by defaut.
                            Do what @JonB suggested. Create a new, empty project and open the MainWindow.

                            What kind of window do we see in your screenshot? Are you sure, that it is your MainWindow? Because you create some QDialogs and QMessageBoxes here:

                            @ELEMENTICY said in Unable to restore my Application:

                            void Editor::on_actionNew_triggered()
                            {
                            AddNew *addnew = new AddNew;
                            addnew->show();
                            }

                            and here:

                            @ELEMENTICY said in Unable to restore my Application:

                            void Editor::on_actionOpen_triggered()
                            {
                            QString filename = QFileDialog::getOpenFileName(this, "Choose a file" );
                            QFile file(filename);
                            currentFile = filename;
                            if(!file.open(QIODevice::ReadOnly | QFile::Text)){
                            QMessageBox::warning(this, "Error", "Unable to Open File: " + file.errorString());
                            }
                            QTextStream in(&file);
                            QString text = in.readAll();
                            ui->codingarea->setPlainText(text);
                            ui->itemname->setText(filename);
                            file.close();
                            }

                            You don't show us the titlebar of your AddNew dialog(?) or your QFileDialog, don't you? :-)

                            E Offline
                            E Offline
                            ELEMENTICY
                            wrote on last edited by
                            #13

                            @Pl45m4 im sure its mainwindows.And these
                            void Editor::on_action......

                            is the trigger button on menu.
                            which just open up new window only.And the current one is 100% MainWindow

                            1 Reply Last reply
                            0
                            • JKSHJ JKSH

                              @ELEMENTICY said in Unable to restore my Application:

                              i cant click the restore button,
                              alt text
                              the middle button,between the "_" and "X" button.

                              How did you maximize your window in the first place?

                              @jsulm said in Unable to restore my Application:

                              @ELEMENTICY It's not "restoring", it's resizing.

                              To be fair, that's Windows terminology. If you hover your mouse cursor over the button between "Minimize" and "Close", the tooltip says either "Maximize" or "Restore Down"

                              E Offline
                              E Offline
                              ELEMENTICY
                              wrote on last edited by
                              #14

                              @JKSH

                              QApplication a(argc, argv);
                                  Editor w;
                                  w.setWindowState(Qt::WindowMaximized);
                                  w.show();
                              
                              JKSHJ 1 Reply Last reply
                              0
                              • E ELEMENTICY

                                @JKSH

                                QApplication a(argc, argv);
                                    Editor w;
                                    w.setWindowState(Qt::WindowMaximized);
                                    w.show();
                                
                                JKSHJ Offline
                                JKSHJ Offline
                                JKSH
                                Moderators
                                wrote on last edited by
                                #15

                                @ELEMENTICY said in Unable to restore my Application:

                                    w.setWindowState(Qt::WindowMaximized);
                                

                                What happens if you remove this line?

                                Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                                E 1 Reply Last reply
                                2
                                • JKSHJ JKSH

                                  @ELEMENTICY said in Unable to restore my Application:

                                      w.setWindowState(Qt::WindowMaximized);
                                  

                                  What happens if you remove this line?

                                  E Offline
                                  E Offline
                                  ELEMENTICY
                                  wrote on last edited by
                                  #16

                                  @JKSH still cant restore,just when start,its not fullscreen mode.

                                  J.HilkJ 1 Reply Last reply
                                  0
                                  • E ELEMENTICY

                                    @JKSH still cant restore,just when start,its not fullscreen mode.

                                    J.HilkJ Offline
                                    J.HilkJ Offline
                                    J.Hilk
                                    Moderators
                                    wrote on last edited by
                                    #17

                                    @ELEMENTICY
                                    and

                                    QApplication a(argc, argv);
                                        QWidget w;
                                        w.resize(50,50);
                                        w.setWindowState(Qt::WindowMaximized);
                                        w.show();
                                    

                                    behaves the same? what OS and window manager do you use?


                                    Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                                    Q: What's that?
                                    A: It's blue light.
                                    Q: What does it do?
                                    A: It turns blue.

                                    E 2 Replies Last reply
                                    0
                                    • J.HilkJ J.Hilk

                                      @ELEMENTICY
                                      and

                                      QApplication a(argc, argv);
                                          QWidget w;
                                          w.resize(50,50);
                                          w.setWindowState(Qt::WindowMaximized);
                                          w.show();
                                      

                                      behaves the same? what OS and window manager do you use?

                                      E Offline
                                      E Offline
                                      ELEMENTICY
                                      wrote on last edited by
                                      #18

                                      @J-Hilk windows 10

                                      1 Reply Last reply
                                      0
                                      • J.HilkJ J.Hilk

                                        @ELEMENTICY
                                        and

                                        QApplication a(argc, argv);
                                            QWidget w;
                                            w.resize(50,50);
                                            w.setWindowState(Qt::WindowMaximized);
                                            w.show();
                                        

                                        behaves the same? what OS and window manager do you use?

                                        E Offline
                                        E Offline
                                        ELEMENTICY
                                        wrote on last edited by
                                        #19

                                        @J-Hilk and yea it doesnt work.Also its MainWindow Why dont you trust me xD

                                        Pl45m4P 1 Reply Last reply
                                        0
                                        • E ELEMENTICY

                                          @J-Hilk and yea it doesnt work.Also its MainWindow Why dont you trust me xD

                                          Pl45m4P Offline
                                          Pl45m4P Offline
                                          Pl45m4
                                          wrote on last edited by
                                          #20

                                          @ELEMENTICY

                                          Because it's nearly impossible that you can't resize your window, when you didn't change anything. There must be some settings that got changed.

                                          Have you tried to create an empty project and resize / restore the MainWindow there? Does it work?
                                          Have you checked your design file? Have you made changes there?


                                          If debugging is the process of removing software bugs, then programming must be the process of putting them in.

                                          ~E. W. Dijkstra

                                          E 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