Unsolved Unable to restore my Application
-
@ELEMENTICY said in Unable to restore my Application:
I cant restore my application
Restore from what?
Please explain better what you are doing. -
@jsulm i cant click the restore button,
the middle button,between the "_" and "X" button. -
@ELEMENTICY It's not "restoring", it's resizing. Do you set fixed size for your application window?
-
@jsulm No i didt
-
Hi,
Did you tweak any flags in designer with regards to these buttons ?
-
@ELEMENTICY said in Unable to restore my Application:
i cant click the restore button,
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"
-
@ELEMENTICY
If you're not sure how this came about. Start with a 10-line program which just creates a top-levelQWidget
orQMainWindow
. 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. -
Are you sure it is not QDialog?? If it is Qdialog then it will show like this.
Just see your UI file -
@Thank-You its mainwindows
-
@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 theMainWindow
.What kind of window do we see in your screenshot? Are you sure, that it is your
MainWindow
? Because you create someQDialogs
andQMessageBoxes
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 yourQFileDialog
, don't you? :-) -
@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 -
QApplication a(argc, argv); Editor w; w.setWindowState(Qt::WindowMaximized); w.show();
-
@ELEMENTICY said in Unable to restore my Application:
w.setWindowState(Qt::WindowMaximized);
What happens if you remove this line?
-
@JKSH still cant restore,just when start,its not fullscreen mode.
-
@ELEMENTICY
andQApplication 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?
-
@J-Hilk windows 10
-
@J-Hilk and yea it doesnt work.Also its MainWindow Why dont you trust me xD
-
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? -
This post is deleted! -
@ELEMENTICY
It's usual to supply a minimal example, if you want others to look at it. Yes, that requires reducing one's own code till it is minimal; funnily enough, often that reveals what the problem is. I see , say, 100+-odd lines. Your problem only appears when you open/double-click files, double click items, and have loads of triggers? Otherwise the restoring works OK?