QTabWidget

Topik sebelumnya Topik selanjutnya Go down

Tabwidget sederhana

Post  zz on Thu Nov 05, 2009 2:14 pm

Ini linknya
http://www.ziddu.com/download/7228472/tab.zip.html

zz
Panglima
Panglima

Jumlah posting : 121
Age : 71
Lokasi : france
Registration date : 13.02.09

Lihat profil user

Kembali Ke Atas Go down

QTabWidget

Post  cpp on Fri Jul 10, 2009 9:47 pm

warisan.h
Code:

#ifndef WARISAN_H
#define WARISAN_H
#include <QtGui>
#include <QApplication>
class warisan : public QMainWindow
{
   Q_OBJECT
   public :
   warisan (QMainWindow *parent = 0 ) ;
   ~warisan (){}
   QWidget *centralwidget ;
   QHBoxLayout *horizontalLayout ;
   QVBoxLayout *verticalLayout ;    
   QTabWidget *c ;
   QWidget *tab, *tab_2, *tab_3 ;
   QCommandLinkButton *commandLinkButton;
   QPushButton *pushButton_2 , *pushButton_3, *a ;
   QMenuBar *menubar ;
   QStatusBar *statusbar;
   int x ;
   public slots :
   void TAB_2 ();
   void TAB_3 ();   
};
#endif
warisan.cpp
Code:

#include <warisan.h>
warisan::warisan (QMainWindow *parent) : QMainWindow (parent)
{

    this->resize(604, 420);
    centralwidget = new QWidget (this);
    horizontalLayout = new QHBoxLayout(centralwidget);
    verticalLayout = new QVBoxLayout();
   c = new QTabWidget(centralwidget);
    tab = new QWidget();
    a = new QPushButton(QString ("Lanjut"),tab);
    a->setGeometry(QRect(450, 270, 111, 41));
    c->addTab(tab, QString("Pertama"));
   
    tab_2 = new QWidget();
    pushButton_2 = new QPushButton(QString ("Ok"),tab_2);
    pushButton_2->setGeometry(QRect(480, 280, 80, 28));
   c->addTab ( tab_2, QString("Kedua") );
   
   tab_3 = new QWidget();
    pushButton_3 = new QPushButton(QString ("Ok"),tab_3);
    pushButton_3->setGeometry(QRect(480, 280, 80, 28));
   c->addTab ( tab_3, QString("Ketiga") );
   
    verticalLayout->addWidget(c);
    horizontalLayout->addLayout(verticalLayout);
    this->setCentralWidget(centralwidget);
    menubar = new QMenuBar(this);
    menubar->setGeometry(QRect(0, 0, 604, 26));
    this->setMenuBar(menubar);
    statusbar = new QStatusBar(this);
    this->setStatusBar(statusbar);
   
    c->setCurrentIndex(0);
    c->setTabEnabled(0,true);
   c->setTabEnabled(1,false);   
   c->setTabEnabled(2,false);

    connect (a,SIGNAL(clicked()),this,SLOT(TAB_2()));
    connect (pushButton_2,SIGNAL(clicked()),this,SLOT(TAB_3()));
}
tab_2.cpp
Code:

#include <warisan.h>
void warisan :: TAB_2 ()
{
//   c->addTab(tab_2, QString("Kedua"));
//   c->insertTab (1, tab_2, QString ("Kedua") );
   c->setTabEnabled(1,true);
   c->setCurrentIndex(1);
}
void warisan :: TAB_3 ()
{
   c->setTabEnabled(2,true);
   c->setCurrentIndex(2);
}
main.cpp
Code:

#include <warisan.h>
int main (int argc, char *argv [] )
{
   QApplication app (argc,argv);
   warisan war;
   war.show();
   return app.exec ();
}
Kalau mau download applicasinya ini
http://www.ziddu.com/download/5552802/pp.zip.html
GoodLuck

cpp
Pejuang
Pejuang

Jumlah posting : 35
Registration date : 15.03.09

Lihat profil user

Kembali Ke Atas Go down

Topik sebelumnya Topik selanjutnya Kembali Ke Atas


 
Permissions in this forum:
Anda tidak dapat menjawab topik