Ejemplo n.º 1
0
aboutWidget::aboutWidget(QWidget *parent):
    QDialog(parent),
    ui(new Ui::aboutWidget)
{    
    setWindowFlags(Qt::Dialog |  Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint | Qt::WindowSystemMenuHint);

    ui->setupUi(this);
    ui->labAppName->setText(ui->labAppName->text() + QString(" <b>") + qApp->applicationVersion() + QString("</b>"));

    QString versionInfo;
    versionInfo = tr("built on ");
    versionInfo.append(__DATE__);
    versionInfo.append(" ");
    versionInfo.append(__TIME__);

    ui->labQtVer->setText(tr("using Qt ") + qVersion());

    ui->labVersion->setText(versionInfo);

    QTabBar *tabs = new QTabBar;


    ui->frame->layout()->addWidget(tabs);
    ui->frame->layout()->addWidget(ui->txtArea);

    tabs->setFixedHeight(24);
    tabs->insertTab(0, tr("About"));
    tabs->insertTab(1, tr("Contacts"));
    tabs->insertTab(2, tr("Thanks"));
    connect(tabs, SIGNAL(currentChanged(int)), this, SLOT(changeTab(int)));

    ui->txtArea->setHtml(getAbouT());
}
Ejemplo n.º 2
0
void tst_QTabBar::insertAtCurrentIndex()
{
    QTabBar tabBar;
    tabBar.addTab("Tab1");
    QCOMPARE(tabBar.currentIndex(), 0);
    tabBar.insertTab(0, "Tab2");
    QCOMPARE(tabBar.currentIndex(), 1);
    tabBar.insertTab(0, "Tab3");
    QCOMPARE(tabBar.currentIndex(), 2);
    tabBar.insertTab(2, "Tab4");
    QCOMPARE(tabBar.currentIndex(), 3);
}