createViews();
QVBoxLayout *mainLayout = new QVBoxLayout;
- infoLabel = new QLabel(tr("This is the beginning"),this);
- mainLayout->addWidget(infoLabel);
mainLayout->addWidget(situareViews);
widget->setLayout(mainLayout);
this->setWindowTitle(tr("Situare"));
- createMenus();
}
MainWindow::~MainWindow()
}
-void MainWindow::createMenus()
-{
- 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()
-{
- this->situareViews->setCurrentIndex(0);
- infoLabel->setText(tr("Current: %1").arg(situareViews->currentIndex()));
-}
-
-void MainWindow::toMapView()
-{
- this->situareViews->setCurrentIndex(1);
- infoLabel->setText(tr("Current: %1").arg(situareViews->currentIndex()));
-}
-
void MainWindow::createViews()
{
- situareViews = new QStackedWidget(this);
- situareViews->addWidget(new SituareListView(this));
- situareViews->addWidget(new SituareMapView(this));
+ situareViews = new QTabWidget(this);
+ situareViews->addTab(new SituareListView(this), tr("List"));
+ situareViews->addTab(new SituareMapView(this), tr("Map"));
}
SituareListView::SituareListView(QWidget *parent)
class QMenu;
class QAction;
-class QStackedWidget;
+class QTabWidget;
class QLabel;
/**
private:
/**
- * @brief Private method to create the Menu items
- *
- * @fn createMenus
- */
- void createMenus();
- /**
* @brief Private method to create List and Map views as a stacked widget
*
* @fn createViews
*/
void createViews();
- QMenu *viewMenu;
- /**
- * @brief Action item for changing view to List View
- *
- * @var toListViewAct
- */
- QAction *toListViewAct;
- /**
- * @brief Action item for changing view to Map View
- *
- * @var toMapViewAct
- */
QAction *toMapViewAct;
/**
* @brief Widget Stack object for the List and Map Views
*
* @var situareViews
*/
- QStackedWidget *situareViews;
+ QTabWidget *situareViews;
/**
* @brief DUMMY LABEL, REMOVE WHEN BOTH VIEWS ARE COMPLETE
*/
QLabel *infoLabel;
-private slots:
- /**
- * @brief Private slot, which initiates toListViewAct action
- *
- * @fn toListView
- */
- void toListView();
- /**
- * @brief Private slots, which initiates toMapViewAct action
- *
- * @fn toMapView
- */
- void toMapView();
};
/**
Copyright (C) 2010 Ixonos Plc. Authors:
Henri Lampela - henri.lampela@ixonos.com
+ Kaj Wallin - kaj.wallin@ixonos.com
Situare is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
private slots:
void testUi();
-
-
+ void testViews();
};
void TestUi::testUi()
QCOMPARE(lineEdit.text(), QString("UI test"));
}
+void TestUi::testViews()
+{
+
+}
+
QTEST_MAIN(TestUi)
#include "testui.moc"