Unsolved Basic problem of main.cpp
-
Hello everyone.
I just started a program and I have a petit when compiling the code.
When I compile the IDE I get the following errors:
1 - "FenPrincipale" was not declared in scope
2 - Expected ";" before window
3 - "window" was not declared in scope.
All the errors are located in the main.cppThe main.cpp
#include <QApplication> #include <QtWidgets> #include "ui_fenprincipale.h" int main(int argc, char *argv[]) { QApplication app(argc, argv); FenPrincipale fenetre; fenetre.show(); return app.exec(); }
The fenprincipale.h
#ifndef FENPRINCIPALE_H #define FENPRINCIPALE_H #include <QMainWindow> namespace Ui { class FenPrincipale; } class FenPrincipale : public QMainWindow { Q_OBJECT public: explicit FenPrincipale(QWidget *parent = 0); ~FenPrincipale(); private: Ui::FenPrincipale *ui; }; #endif // FENPRINCIPALE_H
The fenprincipale.cpp
#include "fenprincipale.h" #include "ui_fenprincipale.h" FenPrincipale::FenPrincipale(QWidget *parent) : QMainWindow(parent), ui(new Ui::FenPrincipale) { ui->setupUi(this); } FenPrincipale::~FenPrincipale() { delete ui; }
The errors are in the main.cpp
Accuracy: I am a beginner so try to explain the solution for me to learn.
Thanks -
This post is deleted! -
@Nafab213 said in Basic problem of main.cpp:
#include "ui_fenprincipale.h"
You should have
#include "fenprincipale.h"
in your main.cpp file
-
@kenchan
Everything is working now but I have another problem.
In the Qt Designer, I put a File left and vertical file and an Edit toolbar on the top left but it does not take compilation. When I leave the file and return to the file the file toolbar returns to the top left side.
How to write define the modification of the position and the size of my toolbar.
I'm sending you an image to show you.The File Toolbar is on the left
The toolbar Edition is in the middle but I want them defensively in the following order:
ToolbarLong Vertical File
ToolbarEdition Up Horizontal
Can I help? -
Not sure just by looking at that picture. They look to be the correct orientation to me. Is the horizontal one actually docked at the top, or is it floating?
You can restrict where they can dock, that might help. -
@kenchan said in Basic problem of main.cpp:
Not sure just by looking at that picture. They look to be the correct orientation to me. Is the horizontal one actually docked at the top, or is it floating?
You can restrict where they can dock, that might help.How can I restrict their access?
Explain to me .... -
Click on the toolbar in the object list on the right hand side of the Design screen.
look at the properties for the QToolBar object at the bottom of the property list.
Check the allowedAreas that you want to restrict the toolbars docking to. -
Hi
The docking places looks like this
so i think you can only place them like
and not like
-
@mrjj
Thanks for the advice but I decided to put all the toolbar up and horizontal.
Now I have another question ..On my main page there are two buttons.
If we click on the button 1
I would like a table to appear instead of the centralwidget of my window (I intend to create the new Qwidget class called TableauCene). The button 1 will be connected to the slot (showcene) which will display as centralwidget Tableaucene.If we click on the Boutton 2
I would like a table to appear instead of the centralwidget of my window (I intend to create the new Qwidget class called TableauCenep). Button 2 will be connected to the slot (showcenep) which will display as the tableapple centralwidget.How can I program slots "showcene" and "showcenep"?
Thanks for your help.... -
@kenchan
Thanks for the advice but I decided to put all the toolbar up and horizontal.
Now I have another question ..
On my main page there are two buttons.
If we click on the button 1
I would like a table to appear instead of the centralwidget of my window (I intend to create the new Qwidget class called TableauCene). The button 1 will be connected to the slot (showcene) which will display as centralwidget Tableaucene.If we click on the Boutton 2
I would like a table to appear instead of the centralwidget of my window (I intend to create the new Qwidget class called TableauCenep). Button 2 will be connected to the slot (showcenep) which will display as the tableapple centralwidget.How can I program slots "showcene" and "showcenep"?
Thanks for your help.... -
Salut,
Have a look at QStackedWidget or QTabWidget, they are commonly use for the things you've described.