コード例 #1
0
ファイル: DJSymbol.cpp プロジェクト: CecilHarvey/BlueDJGames
DJSymbolTable::DJSymbolTable( int type, QWidget* parent, const QSize symbolSize )
	:QTableWidget(parent),m_type(type)
{	
	djDebug() << "DJSymbolTable constructor";
	setSelectionMode( QAbstractItemView::NoSelection );
	setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
	setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOn );
	setGridStyle( Qt::NoPen );
	setShowGrid( false );
	setSymbolSize( symbolSize );
	
	switch ( m_type ) {
	case PLAYER_SYMBOL_WIDGET: {
		setDirPath( ":/BaseRes/image/face" );
		createSymbolItems();
		break;
	}
	case MEMBER_SYMBOL_WIDGET: {
		setDirPath( "images/member" );
		createSymbolItems();
		break;
	}
	default:
		djDebug() << "symbol type error";	
		break;
	}
	
	connect( this, SIGNAL(itemClicked(QTableWidgetItem *)),SLOT(handleItemClicked(QTableWidgetItem *)));
	connect( this, SIGNAL(itemDoubleClicked(QTableWidgetItem *)),SLOT(handleItemDoubleClicked(QTableWidgetItem *)));
	
	djDebug() << "DJSymbolTable constructor end";
}
コード例 #2
0
SyncErrorsTableView::SyncErrorsTableView(QWidget *parent)
    : QTableView(parent)
{
    verticalHeader()->hide();
    verticalHeader()->setDefaultSectionSize(36);
    horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
    horizontalHeader()->setStretchLastSection(true);
    horizontalHeader()->setCascadingSectionResizes(true);
    horizontalHeader()->setHighlightSections(false);
    horizontalHeader()->setDefaultAlignment(Qt::AlignLeft | Qt::AlignVCenter);

    setGridStyle(Qt::NoPen);
    setShowGrid(false);
    setContentsMargins(0, 0, 0, 0);
    setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);

    setSelectionBehavior(QAbstractItemView::SelectRows);
    setSelectionMode(QAbstractItemView::ExtendedSelection);
    setMouseTracking(true);

    createContextMenu();

    connect(this, SIGNAL(doubleClicked(const QModelIndex&)),
            this, SLOT(onItemDoubleClicked(const QModelIndex&)));
}
コード例 #3
0
ファイル: FiGroupWidget.cpp プロジェクト: loh-tar/filu
/***********************************************************************
*
*   MyTableWidget stuff
*
************************************************************************/
MyTableWidget::MyTableWidget(QWidget* parent)
             : QTableWidget(parent)
{
  setDragEnabled(true);
  setAcceptDrops(true);
  horizontalHeader()->hide();
  horizontalHeader()->setStretchLastSection(true);
  verticalHeader()->hide();
  setSelectionBehavior(QAbstractItemView::SelectRows);
  setHorizontalScrollMode(ScrollPerPixel);
  setVerticalScrollMode(ScrollPerPixel);
  setEditTriggers(QAbstractItemView::NoEditTriggers);
  setGridStyle(Qt::NoPen);

  connect(this, SIGNAL(currentItemChanged(QTableWidgetItem *, QTableWidgetItem *))
  , this, SLOT(currentItemChangedSlot(QTableWidgetItem *, QTableWidgetItem *)));

  connect(this, SIGNAL(itemClicked(QTableWidgetItem *))
  , this, SLOT(itemClickedSlot(QTableWidgetItem *)));

  connect(this, SIGNAL(itemDoubleClicked(QTableWidgetItem *))
  , this, SLOT(itemDoubleClickedSlot(QTableWidgetItem *)));
}