MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
+ QWidget *widget = new QWidget;
+ setCentralWidget(widget);
+// createViews();
+
+ QVBoxLayout *mainleiska = new QVBoxLayout;
+ infoLabel = new QLabel(tr("This is the beginning"),this);
+ mainleiska->addWidget(infoLabel);
+
+ widget->setLayout(mainleiska);
this->setWindowTitle(tr("Situare"));
createMenus();
+
}
MainWindow::~MainWindow()
void MainWindow::createMenus()
{
- toListViewAct = new QAction(tr("List"),this);
- toMapViewAct = new QAction(tr("Map"),this);
+ toListViewAct = new QAction(tr("List"), this);
+ connect(toListViewAct, SIGNAL(triggered()), this, SLOT(toListView()));
+ toMapViewAct = new QAction(tr("Map"), this);
+ connect(toMapViewAct, SIGNAL(triggered()), this, SLOT(toMapView()));
viewMenu = menuBar()->addMenu(tr("View"));
viewMenu->addAction(toListViewAct);
viewMenu->addAction(toMapViewAct);
}
+
+void MainWindow::toListView()
+{
+ infoLabel->setText(tr("List view invoked"));
+}
+
+void MainWindow::toMapView()
+{
+ infoLabel->setText(tr("Map view invoked"));
+}
+
+void MainWindow::createViews()
+{
+ situareViews = new QStackedWidget(this);
+ situareViews->addWidget(new SituareListView(this));
+ situareViews->addWidget(new SituareMapView(this));
+}
+
+SituareListView::SituareListView(QWidget *parent)
+ : QWidget(parent)
+{
+ QPushButton *listViewButton = new QPushButton(tr("This is listview"));
+ QHBoxLayout *listViewLayout = new QHBoxLayout;
+ listViewLayout->addWidget(listViewButton);
+ setLayout(listViewLayout);
+}
+
+SituareMapView::SituareMapView(QWidget *parent)
+ : QWidget(parent)
+{
+ QPushButton *mapViewButton = new QPushButton(tr("THIS IS MAPVIEW !!"));
+ QHBoxLayout *mapViewLayout = new QHBoxLayout;
+ mapViewLayout->addWidget(mapViewButton);
+ setLayout(mapViewLayout);
+}