Пример #1
0
void
TagColorEditor::createGUI()
{
  table = new QTableWidget(16, 16);
  table->resize(300, 300);
  table->verticalHeader()->hide();
  table->horizontalHeader()->hide();
  table->setSelectionMode(QAbstractItemView::NoSelection);
  table->setStyleSheet("QTableWidget {gridline-color:black;}");

  setColors();

  for (int i=0; i < table->rowCount(); i++)
    table->setRowHeight(i, 20);

  for (int i=0; i < table->columnCount(); i++)
    table->setColumnWidth(i, 40);

  QPushButton *newTags = new QPushButton("New Tag Colors");

  QVBoxLayout *layout = new QVBoxLayout;
  layout->addWidget(newTags);
  layout->addWidget(table);
  
  setLayout(layout);
  
  setWindowTitle(tr("Tag Color Editor"));

  connect(newTags, SIGNAL(clicked()),
	  this, SLOT(newTagsClicked()));

  connect(table, SIGNAL(cellClicked(int, int)),
	  this, SLOT(cellClicked(int, int)));
}
Пример #2
0
void
TagColorEditor::createGUI()
{
  //table = new QTableWidget(32, 8);
  table = new QTableWidget(52, 5);
  table->resize(300, 300);
  table->setEditTriggers(QAbstractItemView::NoEditTriggers); // disable number editing
  table->verticalHeader()->hide();
  table->horizontalHeader()->hide();
  table->setSelectionMode(QAbstractItemView::NoSelection);
  table->setStyleSheet("QTableWidget{gridline-color:white;}");

  setColors();

  for (int i=0; i < table->rowCount(); i++)
    table->setRowHeight(i, 25);

  for (int i=0; i < table->columnCount(); i++)
#if defined(Q_OS_WIN32)
    table->setColumnWidth(i, 50);
#else
    table->setColumnWidth(i, 60);
#endif

  QPushButton *newTags = new QPushButton("New Tag Colors");
  QPushButton *showTags = new QPushButton("Show All Tags");
  QPushButton *hideTags = new QPushButton("Hide All Tags");

  QHBoxLayout *hlayout = new QHBoxLayout;
  hlayout->addWidget(newTags);
  hlayout->addWidget(showTags);
  hlayout->addWidget(hideTags);
  QVBoxLayout *layout = new QVBoxLayout;
  layout->addLayout(hlayout);
  layout->addWidget(table);
  
  setLayout(layout);
  
  setWindowTitle(tr("Tag Color Editor"));

  connect(newTags, SIGNAL(clicked()),
	  this, SLOT(newTagsClicked()));

  connect(showTags, SIGNAL(clicked()),
	  this, SLOT(showTagsClicked()));

  connect(hideTags, SIGNAL(clicked()),
	  this, SLOT(hideTagsClicked()));

  connect(table, SIGNAL(cellClicked(int, int)),
	  this, SLOT(cellClicked(int, int)));

  connect(table, SIGNAL(cellDoubleClicked(int, int)),
	  this, SLOT(cellDoubleClicked(int, int)));
}