コード例 #1
0
KWStatisticsDialog::KWStatisticsDialog( QWidget *parent, KWDocument *document )
    : KDialogBase(parent, "statistics", true, i18n("Statistics"),KDialogBase::Ok, KDialogBase::Ok, false )
{
    QWidget *page = new QWidget( this );
    setMainWidget(page);
    QVBoxLayout *topLayout = new QVBoxLayout( page, 0, KDialog::spacingHint() );

    QTabWidget *tab = new QTabWidget( page );
    QFrame *pageAll = 0;
    QFrame *pageGeneral = 0;
    QFrame *pageSelected = 0;
    for (int i=0; i < 7; ++i) {
        m_resultLabelAll[i] = 0;
        m_resultLabelSelected[i] = 0;
        if ( i < 6 )
            m_resultGeneralLabel[i]=0;
    }
    m_doc = document;
    m_parent = parent;
    m_canceled = true;


    // add Tab "General"
    pageGeneral = new QFrame( this );
    tab->addTab( pageGeneral,  i18n( "General" ) );

    addBoxGeneral( pageGeneral, m_resultGeneralLabel );
    calcGeneral( m_resultGeneralLabel );

    // add Tab "All"
    pageAll = new QFrame( this );
    tab->addTab( pageAll,  i18n( "Text" ) );

    addBox( pageAll, m_resultLabelAll, true );

    m_canceled = true;
    pageSelected = new QFrame( this );
    tab->addTab( pageSelected,  i18n( "Selected Text" ) );
    // let's see if there's selected text
    bool b = docHasSelection();
    tab->setTabEnabled(pageSelected, b);
    if ( b ) {
        addBox( pageSelected, m_resultLabelSelected,  false);
        // assign results to 'selected' tab.
        if ( !calcStats( m_resultLabelSelected, true,true ) )
            return;
        if ( !calcStats( m_resultLabelAll, false,false ) )
            return;
        showPage( 2 );
    } else {
        // assign results
        if ( !calcStats( m_resultLabelAll, false, false ) )
            return;
        showPage( 1 );
    }
    topLayout->addWidget( tab );
    m_canceled = false;

}
コード例 #2
0
GameSelectionWindow::GameSelectionWindow(QWidget* parent) :
		QWidget(parent), m_selectedGameWidget(NULL) {
	this->setWindowTitle(QString(ms_gameControllerInstance->m_applicationTitle.c_str()));
	this->setMinimumWidth(900);
	this->setMinimumHeight(600);
	this->move(200, 200);

	// set text based on logged in/offline status
	QString greetingLabelText;
	QString logoutButtonText;
	if (ms_gameControllerInstance->inOnlineMode()) {
		greetingLabelText = "Welcome, "
				+ QString(ms_gameControllerInstance->m_username.c_str());
		logoutButtonText = QString(ms_onlineLogoutText.c_str());
	} else {
		greetingLabelText = QString(ms_offlineModeGreeting.c_str());
		logoutButtonText = QString(ms_offlineLogoutText.c_str());
	}

	// layout for entire window
	QVBoxLayout* windowLayout = new QVBoxLayout();

	// construct greeting label (upper rh corner)
	QLabel* greetingLabel = new QLabel(greetingLabelText);
	windowLayout->addWidget(greetingLabel, 0, Qt::AlignRight);

	// create tabbed pane, to hold main contents
	QTabWidget* tabbedPane = new QTabWidget();
	tabbedPane->setMaximumWidth(16777215);

	QWidget* gamesTab = constructGameSelectionTab();
	tabbedPane->addTab(gamesTab, QString(ms_gamesTabTitle.c_str()));

	if (ms_gameControllerInstance->inOnlineMode()) {
		QWidget* statsTab = constructStatisticsTab();
		tabbedPane->addTab(statsTab, QString(ms_statsTabTitle.c_str()));
	} else {
		int statTabId = tabbedPane->addTab(new QWidget(),
				QString(ms_statsTabTitle.c_str()));
		tabbedPane->setTabEnabled(statTabId, false);
	}

	windowLayout->addWidget(tabbedPane, 100);

	// logout button (bottom lh corner)
	QPushButton* logoutReturnButton = new QPushButton(logoutButtonText);
	QObject::connect(logoutReturnButton, SIGNAL(clicked()), this,
			SLOT(logoutAndReturn()));
	windowLayout->addWidget(logoutReturnButton, 0, Qt::AlignLeft);

	// set layout
	this->setLayout(windowLayout);
}
コード例 #3
0
ファイル: QtlTabWidget.cpp プロジェクト: Wushaowei001/NAF
int TabWidget::setTabEnabled( lua_State * L ) // ( int index, bool enable )void
{
	QTabWidget* obj = ObjectHelper<QTabWidget>::check( L, 1 );
	int index = 0;
	if ( Util::isNum( L, 2 ) )
	{
		if ( Util::toInt( L, 2 )>=0 )
		{
			index = Util::toInt( L, 2 );
		}
		else
		{
			Util::error( L, "Invalid Index" );
		}
	}
	obj->setTabEnabled( index, Util::toBool( L, 3 ) );
	return 0;
}
コード例 #4
0
ファイル: mainwindow.cpp プロジェクト: ankeshanand/surp
//constructor
MainWindow::MainWindow(QWidget *parent) :QMainWindow(parent)
{
    managerLoginPage();
    receptionPage();
    cateringPage();

    QTabWidget *tabWidget = new QTabWidget;
    tabWidget->insertTab(0, receptionWidget,tr("&Reception"));
    tabWidget->insertTab(1, managerLoginWidget, tr("Manager Login"));
    tabWidget->insertTab(2, cateringWidget, tr("Catering Services"));
    tabWidget->setTabEnabled(0, true);


    setCentralWidget(tabWidget);
    cateringServices = new CateringServices;   //A universal catering service object. Reinitailise for new use.
    manager = new Management;

    updateVisit_MonthCount();          //update month count for token

}
コード例 #5
0
void ScriptToolbox::tabSetTabEnabled(QWidget * tab, int idx, bool enable)
{
    QTabWidget *tw = qobject_cast<QTabWidget*>(tab);
    if(tw)
        tw->setTabEnabled(idx, enable);
}
コード例 #6
0
void QTabWidgetProto::setTabEnabled(int index, bool enable)
{
  QTabWidget *item = qscriptvalue_cast<QTabWidget*>(thisObject());
  if (item)
    item->setTabEnabled(index, enable);
}