Example #1
0
AppWindow::AppWindow()
	: m_current_page(NULL)
	, m_busy(false)
{
	setObjectName("AppWindow");

	// We want the toolbar to show actions as tabs. I.e., be a tab bar.
	setToolbarViewType(MToolBar::tabType);

	actionGroup = new QActionGroup(this);
	actionGroup->setExclusive(true);
	connect(actionGroup, SIGNAL(triggered(QAction*)), SLOT(showPageForAction(QAction*)));

	// Пункты меню
	{
		MAction *action = new MAction("Options", this);
		action->setLocation(MAction::ApplicationMenuLocation);
		connect(action, SIGNAL(triggered()), SIGNAL(sig_showOptionsPage()));
		addAction(action);
	}
	{
		MAction *action = new MAction("Log", this);
		action->setLocation(MAction::ApplicationMenuLocation);
		connect(action, SIGNAL(triggered()), SIGNAL(sig_showLogPage()));
		addAction(action);
	}
	{
		MAction *action = new MAction("Quit", this);
		action->setLocation(MAction::ApplicationMenuLocation);
		connect(action, SIGNAL(triggered()), SLOT(close()));
		addAction(action);
	}

	show();
}
SampleWindow::SampleWindow(QWidget *parent) : MApplicationWindow(parent)
{

    // We want the toolbar to show actions as tabs. I.e., be a tab bar.
    setToolbarViewType(MToolBar::tabType);

    currentAction = 0;

    actionGroup = new QActionGroup(this);
    actionGroup->setExclusive(true);

    QAction *alphaAction = createAction("Alpha", true);
    createAction("Beta");
    createAction("Gamma");
    createAction("Delta");

    connect(actionGroup, SIGNAL(triggered(QAction*)), SLOT(showPageForAction(QAction*)));

    showPageForAction(alphaAction);
}