#include "widget.h"
Widget::Widget(QWidget *parent)
: QWidget(parent)
{
box=QSharedPointer<QToolBox>
(new QToolBox(this));
lay=QSharedPointer<QHBoxLayout>
(new QHBoxLayout(this));
btn[0] = QSharedPointer<QPushButton>
(new QPushButton("DataBase - 1",this));
btn[1] = QSharedPointer<QPushButton>
(new QPushButton("Network - 2",this));
btn[2] = QSharedPointer<QPushButton>
(new QPushButton("Graphics - 3",this));
box->addItem(btn[0].get(),"DataBase"); //DataBase를 누르면 DataBase - 1 버튼이 나옴
box->addItem(btn[1].get(),"Network"); //Network를 누르면 Networkr -2버튼이 나옴
box->addItem(btn[2].get(),"Graphics"); //Graphics를 누르면 Graphics - 3버튼이 나옴
lay->addWidget(box.get()); //layer 의 가로 방향으로 위젯을 배치함
setLayout(lay.get());
connect(box.get(),SIGNAL(currentChanged(int)),
this,SLOT(changedTab(int)));
}
void Widget::changedTab(int index)
{
qDebug("current index : %d",index);
}
Widget::~Widget()
{
}