Exemplo n.º 1
0
void BuddyContactsTable::createGui()
{
	QHBoxLayout *layout = new QHBoxLayout(this);

	View = new QTableView(this);
	View->setAlternatingRowColors(true);
	View->setDragEnabled(true);
	View->setEditTriggers(QAbstractItemView::AllEditTriggers);
	View->setItemDelegate(Delegate);
	View->setModel(Proxy);

	View->setSelectionBehavior(QAbstractItemView::SelectRows);
	View->setVerticalHeader(0);

	View->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
	View->horizontalHeader()->setStretchLastSection(true);

	connect(View->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)),
			this, SLOT(viewSelectionChanged(QModelIndex,QModelIndex)));

	layout->addWidget(View);

	QWidget *buttons = new QWidget(View);
	QVBoxLayout *buttonsLayout = new QVBoxLayout(buttons);

	MoveUpButton = new QPushButton(tr("Move up"), buttons);
	connect(MoveUpButton, SIGNAL(clicked(bool)), this, SLOT(moveUpClicked()));
	buttonsLayout->addWidget(MoveUpButton);

	MoveDownButton = new QPushButton(tr("Move down"), buttons);
	connect(MoveDownButton, SIGNAL(clicked(bool)), this, SLOT(moveDownClicked()));
	buttonsLayout->addWidget(MoveDownButton);

	AddContactButton = new QPushButton(tr("Add contact"), buttons);
	connect(AddContactButton, SIGNAL(clicked(bool)), this, SLOT(addClicked()));
	buttonsLayout->addWidget(AddContactButton);

	DetachContactButton = new QPushButton(tr("Detach contact"), buttons);
	connect(DetachContactButton, SIGNAL(clicked(bool)), this, SLOT(detachClicked()));
	buttonsLayout->addWidget(DetachContactButton);

	RemoveContactButton = new QPushButton(tr("Remove contact"), buttons);
	connect(RemoveContactButton, SIGNAL(clicked(bool)), this, SLOT(removeClicked()));
	buttonsLayout->addWidget(RemoveContactButton);

	viewSelectionChanged(QModelIndex(), QModelIndex());
	layout->addWidget(buttons);
}
void KTNEFMain::setupTNEF()
{
  mView = new KTNEFView( this );
  mView->setAllColumnsShowFocus( true );
  mParser = new KTNEFParser;

  setCentralWidget(mView);

  connect( mView, SIGNAL(itemSelectionChanged()),
           SLOT(viewSelectionChanged()) );

  connect( mView, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)),
           SLOT(viewDoubleClicked(QTreeWidgetItem*)) );

//PORTME:  connect( mView, SIGNAL(dragRequested(QList<KTNEFAttach*>)),
//PORTME:           SLOT(viewDragRequested(QList<KTNEFAttach*>)) );
}