void toTreeWidget::setResizeMode(ResizeMode m)
{
    columnResize = m;

    if (columnResize == NoColumn)
        return;

    if (columnResize == AllColumns)
        resizeColumnsToContents();

    // qtreewidget will by default allow the last column the most
    // space.
    if (columnResize == LastColumn)
        resizeColumnsToContents();
}
Esempio n. 2
0
void EventTableWidget::uiInit() {
	QStringList tableHeader;
	tableHeader << "Event" << "Origin Time" << "Magnitude" << "Magnitude Type"
				<< "Region" << "Latitude" << "Longitude" << "Depth";

	setRowCount(0);
	setColumnCount(tableHeader.size());
	setHorizontalHeaderLabels(tableHeader);

	QHeaderView* horizontalHeaderRef = horizontalHeader();
	horizontalHeaderRef->setResizeMode(horizontalHeaderRef->count()-1, QHeaderView::Stretch);
	resizeColumnsToContents();

	setAlternatingRowColors(true);
	setSelectionBehavior(QAbstractItemView::SelectRows);
	setSelectionMode(QAbstractItemView::SingleSelection);

	QVBoxLayout* layout = new QVBoxLayout;
	setLayout(layout);

	QSizePolicy sizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
	sizePolicy.setHorizontalStretch(1);
	sizePolicy.setVerticalStretch(0);
	sizePolicy.setHeightForWidth(true);
	setSizePolicy(sizePolicy);
}
Esempio n. 3
0
void Window::clearPlanetConnectionError(const Planet &planet)
{
    QStandardItem* planetItem = getPlanetTreeWidgetItem(planet);
    QStandardItem* errorItem = planetTreeModel->item(planetItem->row(), 1);
    errorItem->setText("");
    resizeColumnsToContents();
}
DbTable::DbTable(list<ColumnConfig> cc,const litesql::Expr & expr,Wt::WContainerWidget * parent):
    Wt::Ext::TableView(parent),
    _column_config(cc),
    _sql(sql) {
    setBorder(false);
    model=new DbTableModel(cc,expr,parent);
    setModel(model);
    setAlternatingRowColors(true);
    resizeColumnsToContents(true);
    setHighlightMouseOver(true);
    setSelectionBehavior(Wt::SelectRows);
    setSelectionMode(Wt::SingleSelection);
    std::list<ColumnConfig>::iterator confit=cc.begin();
    for(int a=0; confit!=cc.end(); confit++, a++) {
//          enableColumnHiding(a, true);
//          setColumnSortable(a, true);
        setColumnWidth(a,(*confit).getWidth());
    }
    _clickCount=0;
    cellClicked().connect(SLOT(this,DbTable::itemSelected));
    doubleClickTimer=new Wt::WTimer(this);
    doubleClickTimer->setInterval(200);
    doubleClickTimer->timeout().connect(SLOT(this, DbTable::emitClickCount));

}
Esempio n. 5
0
rulesDialog::rulesDialog( const QMap<QString, TopologyRule>& testMap, QgisInterface *theQgisIface, QWidget *parent )
    : QDialog( parent ), Ui::rulesDialog()
{
  setupUi( this );

  mQgisIface = theQgisIface;

  //setHorizontalHeaderItems();
  mRulesTable->hideColumn( 4 );
  mRulesTable->hideColumn( 5 );

  mTestConfMap = testMap;
  mRulesTable->setSelectionBehavior( QAbstractItemView::SelectRows );
  mRuleBox->addItems( mTestConfMap.keys() );

  mAddTestButton->setIcon( QIcon( QgsApplication::iconPath( "symbologyAdd.svg" ) ) );
  mDeleteTestButton->setIcon( QIcon( QgsApplication::iconPath( "symbologyRemove.svg" ) ) );

  connect( mAddTestButton, SIGNAL( clicked() ), this, SLOT( addRule() ) );
  connect( mAddTestButton, SIGNAL( clicked() ), mRulesTable, SLOT( resizeColumnsToContents() ) );
  // attempt to add new test when Ok clicked
  //connect( buttonBox, SIGNAL( accepted() ), this, SLOT( addTest() ) );
  connect( mDeleteTestButton, SIGNAL( clicked() ), this, SLOT( deleteTest() ) );

  connect( mLayer1Box, SIGNAL( currentIndexChanged( const QString& ) ), this, SLOT( updateRuleItems( const QString& ) ) );
  connect( mRuleBox, SIGNAL( currentIndexChanged( const QString& ) ), this, SLOT( showControls( const QString& ) ) );

  mRuleBox->setCurrentIndex( 0 );

  //this resets this plugin up if a project is loaded
  connect( mQgisIface, SIGNAL( projectRead() ), this, SLOT( projectRead() ) );
  //reset plugin if new project is activated
  projectRead();
}
Esempio n. 6
0
 // ---------------------------------------------------------------------------------
 KProjectsTable::KProjectsTable ( QWidget *parent )
     : QTableView ( parent )
     , _M_model ( new detail::KProjectsTableModel ( this ) )
 {
   setModel ( _M_model );
   resizeColumnsToContents();
 }
Esempio n. 7
0
void GameList::ShowContextMenu(const QPoint& pos)
{
    QMenu headerMenu;
    QAction* filterTag = headerMenu.addAction(tr("Find tag..."));
    headerMenu.addSeparator();
    QAction* hide = headerMenu.addAction(tr("Hide Column"));
    headerMenu.addSeparator();
    QAction* resizeAll = headerMenu.addAction(tr("Resize visible Columns"));
    QAction* showAll = headerMenu.addAction(tr("Show all Columns"));

    QAction* selectedItem = headerMenu.exec(mapToGlobal(pos));
    int column = columnAt(pos.x());
    if (selectedItem == filterTag)
    {
        simpleSearch(column);
    }
    else if(selectedItem == hide)
    {
        if(column > 0)
        {
            hideColumn(column);
        }
    }
    else if(selectedItem == showAll)
    {
        for(int i = 0; i < model()->columnCount(); ++i)
        {
            showColumn(i);
        }
    }
    else if (selectedItem == resizeAll)
    {
        resizeColumnsToContents();
    }
}
Esempio n. 8
0
CostMatrixTableView::CostMatrixTableView(QWidget *parent) :
    QTableView(parent)
{
    setItemDelegate(new CostMatrixDelegate(this));

    // Context menu
    contextMenu = new QMenu;
    copyAction = new QAction(QIcon(":/icons/img/edit-copy.png"), "Copy", this);
    copyAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_C));
    copyAction->setShortcutContext(Qt::WidgetShortcut);
    addAction(copyAction);
    connect(copyAction, SIGNAL(triggered()), this, SLOT(onCopyAction()));
    contextMenu->addAction(copyAction);
    pasteAction = new QAction(QIcon(":/icons/img/edit-paste.png"), "Paste", this);
    pasteAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_V));
    pasteAction->setShortcutContext(Qt::WidgetShortcut);
    addAction(pasteAction);
    connect(pasteAction, SIGNAL(triggered()), this, SLOT(onPasteAction()));
    contextMenu->addAction(pasteAction);
    contextMenu->addSeparator();
    contextMenu->addAction(
        QIcon(":/icons/img/autofit-width.png"),
        "Resize columns to contents",
        this, SLOT(resizeColumnsToContents()));
}
Esempio n. 9
0
void BaseTreeView::reset()
{
    QTreeView::reset();
    if (header() && m_alwaysAdjustColumnsAction
            && m_alwaysAdjustColumnsAction->isChecked())
        resizeColumnsToContents();
}
Esempio n. 10
0
bool BaseTreeView::handleBaseContextAction(QAction *act)
{
    if (act == 0)
        return true;
    if (act == m_adjustColumnsAction) {
        resizeColumnsToContents();
        return true;
    }
    if (act == m_alwaysAdjustColumnsAction) {
        if (act->isChecked())
            resizeColumnsToContents();
        // Action triggered automatically.
        return true;
    }
    return false;
}
Esempio n. 11
0
void
Tool::addJob(JobPtr const &job) {
  MainWindow::watchCurrentJobTab()->connectToJob(*job);

  m_model->add(job);
  resizeColumnsToContents();
}
Esempio n. 12
0
void Sbrowse::configureView()
{
	setSelectionBehavior(QAbstractItemView::SelectRows);
	resizeColumnsToContents();
	horizontalHeader()->setStretchLastSection(true);
	selectRow(0);
}
Esempio n. 13
0
void CTableView::adjustSizeToContents()
{
    resizeColumnsToContents();
    resizeRowsToContents();
    int32_t h = rowHeight(1) * model()->rowCount() + 2;
    int32_t w = columnWidth(1) * model()->columnCount() + 2;
    setFixedSize(w, h);
}
Esempio n. 14
0
void EventsWidget::scrollTo(double time)
{
	if (events != nullptr) {
		int n = findBestMatch(time);
		tableView->selectRow(n);
		resizeColumnsToContents();
	}
}
Esempio n. 15
0
void CCTableView::updateSuggestions()
{
    if(!model()) {
        return;
    }

    if(!origModel) origModel=model();
    else delete model();

    completer->updateCurrentSuggestions();

    QList<QStringList> items;
    for(int i=0;i<_data->size();i++) {
        items.push_back(QStringList());
        items[i].push_back((*_data)[i].title());
    }
    bool ok=0;
    qDebug()<<"### COUNT:"<<completer->completionCount();
    for(int i=0;i<completer->completionCount();i++) {
//        QString item=origModel->data(origModel->index(i,0)).toString();
        completer->setCurrentRow(i);
        QString item=completer->currentCompletion();
        item.remove(_prefix);
        item.remove(0,item.lastIndexOf(" ")+1);
        int x=-1;
        for(int j=0;j<_data->size();j++) {
//            qDebug()<<(*_data)[j];
            switch((*_data)[j].indexOf(item)) {
            case -1:
                break;
            default:
                qDebug()<<"ADD";
                x=j;
                break;
            }
            if(x==j) break;
        }
        if(x!=-1) {
            ok=1;
            items[x]<<_data->prefix()+item;
        }
    }
    setModel(new CCTableModel(items));
    int minOK=-1;
    for(int i=0;i<_data->size();i++) {
        if(items[i].size()>1) {
            minOK=i;
            break;
        }
    }
    if(minOK!=-1) {
        setCurrentIndex(model()->index(0,minOK));
    }

    resizeColumnsToContents();
    show();
}
Esempio n. 16
0
/** Round-robin table. Represents one round-robin group of players.
 */
RatingsTable::RatingsTable( Group* group, QWidget* parent )
: GroupTable( group, parent ) 
{
  setupCells();
  updateMatchCells();
  updateTotalRatings();

  resizeColumnsToContents();
}
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    this->tempList = new QHash<int, QList<double> >();
    this->testList = new QHash<int, QList<double> >();

    qtyInput = qtyHidden = qtyOutput = 0;

    lblProcessing = new QLabel("Processando. . .", this, Qt::ToolTip);
    lblProcessing->setStyleSheet("font: 75 20pt \"Arial\";background-color: white;");

    connect(this, SIGNAL(tableUpdated()), ui->tableWidget, SLOT(resizeColumnsToContents()));
    connect(this, SIGNAL(tableUpdated()), ui->tableConfusion, SLOT(resizeColumnsToContents()));
    connect(this, SIGNAL(tableUpdated()), ui->tableTest, SLOT(resizeColumnsToContents()));
}
Esempio n. 18
0
void
Tool::loadAndStart() {
  QSettings reg;
  m_model->loadJobs(reg);

  resizeColumnsToContents();

  m_model->start();
}
Esempio n. 19
0
DataOutputWidget::DataOutputWidget(QWidget *parent)
: QWidget(parent)
, m_model(new DataOutputModel(this))
, m_view(new DataOutputView(this))
, m_isEmpty(true)
{
  m_view->setModel(m_model);

  QHBoxLayout *layout = new QHBoxLayout(this);
  m_dataLayout = new QVBoxLayout();

  KToolBar *toolbar = new KToolBar(this);
  toolbar->setOrientation(Qt::Vertical);
  toolbar->setToolButtonStyle(Qt::ToolButtonIconOnly);
  toolbar->setIconSize(QSize(16, 16));

  /// TODO: disable actions if no results are displayed or selected

  KAction *action;

  action = new KAction( KIcon("distribute-horizontal-x"), i18nc("@action:intoolbar", "Resize columns to contents"), this);
  toolbar->addAction(action);
  connect(action, SIGNAL(triggered()), this, SLOT(resizeColumnsToContents()));

  action = new KAction( KIcon("distribute-vertical-y"), i18nc("@action:intoolbar", "Resize rows to contents"), this);
  toolbar->addAction(action);
  connect(action, SIGNAL(triggered()), this, SLOT(resizeRowsToContents()));

  action = new KAction( KIcon("edit-copy"), i18nc("@action:intoolbar", "Copy"), this);
  toolbar->addAction(action);
  m_view->addAction(action);
  connect(action, SIGNAL(triggered()), this, SLOT(slotCopySelected()));

  action = new KAction( KIcon("document-export-table"), i18nc("@action:intoolbar", "Export..."), this);
  toolbar->addAction(action);
  m_view->addAction(action);
  connect(action, SIGNAL(triggered()), this, SLOT(slotExport()));

  action = new KAction( KIcon("edit-clear"), i18nc("@action:intoolbar", "Clear"), this);
  toolbar->addAction(action);
  connect(action, SIGNAL(triggered()), this, SLOT(clearResults()));

  toolbar->addSeparator();

  KToggleAction *toggleAction = new KToggleAction( KIcon("applications-education-language"), i18nc("@action:intoolbar", "Use system locale"), this);
  toolbar->addAction(toggleAction);
  connect(toggleAction, SIGNAL(triggered()), this, SLOT(slotToggleLocale()));

  m_dataLayout->addWidget(m_view);

  layout->addWidget(toolbar);
  layout->addLayout(m_dataLayout);
  layout->setContentsMargins(0, 0, 0, 0);

  setLayout(layout);
}
Esempio n. 20
0
void Foundlist::handleNewData( int i )
{
   if( (i == 0) || (mQuery.mEntries.size() == 0) )
   {
      return;
   }

   setRowCount( i );
   --i;

   int playtime = mQuery.mEntries.at(i).playtime / 75;
   QString displaytime( QString::number( playtime / 60 ) );
   displaytime.append(":");
   if( (playtime % 60) < 10 )
   {
      displaytime.append("0");
   }
   displaytime.append( QString::number( playtime % 60 ) );

   QTableWidgetItem *categoryItem =
      new QTableWidgetItem( mQuery.mEntries.at(i).category );
   categoryItem->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled );
   setItem( i, 0, categoryItem );

   QTableWidgetItem *idItem =
      new QTableWidgetItem( mQuery.mEntries.at(i).id );
   idItem->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled );
   setItem( i, 1, idItem );

   QTableWidgetItem *trackItem =
      new QTableWidgetItem( QString::number( mQuery.mEntries.at(i).track ) );
   trackItem->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled );
   setItem( i, 2, trackItem );

   QTableWidgetItem *titleItem =
      new QTableWidgetItem( mQuery.mEntries.at(i).title );
   titleItem->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled );
   setItem( i, 3, titleItem );

   QTableWidgetItem *playtimeItem =
      new QTableWidgetItem( displaytime );
   playtimeItem->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled );
   setItem( i, 4, playtimeItem );

#if INCLUDE_EXT
   if( mQuery.mEntries.count() > 5 )
   {
      QTableWidgetItem *extItem =
         new QTableWidgetItem( mQuery.mEntries.at(i).ext );
      categoryItem->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled );
      setItem( i, 5, extItem );
   }
#endif

   resizeColumnsToContents();
}
Esempio n. 21
0
void EventsWidget::scrollTo(int n)
{
	if (n < 0 || events == nullptr)
		return;
	unsigned int index = (unsigned int) n;
	if (index < events->size()) {
		tableView->selectRow(index);
		resizeColumnsToContents();
	}
}
Esempio n. 22
0
OrderLineView::OrderLineView(QWidget* parent) : 
	QTableView(parent)
{
	setSelectionMode(QAbstractItemView::SingleSelection);
	setSelectionBehavior(QAbstractItemView::SelectRows);
	setEditTriggers(QAbstractItemView::NoEditTriggers);
	resizeColumnsToContents();
	setColumnHidden(0, true);
	setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
}
Esempio n. 23
0
void GrowingTableWidget::DataChanged(const QModelIndex& tl, const QModelIndex& br)
{
    Q_UNUSED(tl);
    Q_UNUSED(br);
    resizeRowsToContents();
    resizeColumnsToContents();
    int h = contentsMargins().top() + contentsMargins().bottom();
    h += horizontalHeader()->height();
    for(int i = 0; i < rowCount(); i++)
        h += rowHeight(i);
    setMinimumHeight(h);
}
Esempio n. 24
0
/** Round-robin table. Represents one round-robin group of players.
 */
RatingsTable::RatingsTable( Group* group, QWidget* parent )
: GroupTable( group, parent ) 
{
  setupCells();
  updateMatchCells();
  updateTotalRatings();

  resizeColumnsToContents();

  setSelectionMode( QAbstractItemView::SingleSelection );
  setSelectionBehavior( QAbstractItemView::SelectRows );
}
Esempio n. 25
0
AggroTable::AggroTable(AIDebugger& debugger) :
		QTableView(), _model(debugger, this), _debugger(debugger) {
	_proxyModel.setSourceModel(&_model);
	setModel(&_proxyModel);
	setAlternatingRowColors(true);
	resizeColumnsToContents();
	setSortingEnabled(false);
	setSelectionMode(QAbstractItemView::NoSelection);
	verticalHeader()->hide();
	setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Expanding);
	for (int c = 0; c < horizontalHeader()->count(); ++c) {
		horizontalHeader()->setSectionResizeMode(c, QHeaderView::Stretch);
	}
}
Esempio n. 26
0
bool TableView::deleteSelected()
{
	QList<int> rows = getSelectedRows();
	qSort(rows.begin(), rows.end(), qGreater<int>());

	for(int i = 0; i < rows.size(); i++)
	{
		model()->removeRow(rows[i]);
	}

	resizeColumnsToContents();

	return true;
}
Esempio n. 27
0
void ThingRulesView::init(QList<ThingFilter*>* flp)
{
	//Создаем модель и связываем модель с представлением
	thingRulesTableModel = new ThingRulesModel(this, flp);
	setModel(thingRulesTableModel);

	// Настройки поведения таблицы
	resizeColumnsToContents();
	horizontalHeader()->setResizeMode(0, QHeaderView::ResizeToContents);
	horizontalHeader()->setResizeMode(1, QHeaderView::ResizeToContents);
	horizontalHeader()->setResizeMode(2, QHeaderView::Stretch);
	horizontalHeader()->setResizeMode(3, QHeaderView::ResizeToContents);
	verticalHeader()->setDefaultAlignment( Qt::AlignHCenter );
	verticalHeader()->setResizeMode(QHeaderView::ResizeToContents);
}
Esempio n. 28
0
EventsWidget::EventsWidget(QWidget *parent):
	QDockWidget(tr("Events"), parent), events(nullptr)
{
	tableView = new QTableView(this);
	eventsModel = new EventsModel(tableView);
	tableView->setModel(eventsModel);
	setWidget(tableView);
	tableView->horizontalHeader()->setStretchLastSection(true);
	resizeColumnsToContents();
	tableView->show();
	tsconnect(tableView, clicked(const QModelIndex &),
		  this, handleClick(const QModelIndex &));
	tsconnect(tableView, doubleClicked(const QModelIndex &),
		  this, handleDoubleClick(const QModelIndex &));
}
Esempio n. 29
0
void Window::addPlanet(Planet* planet)
{
    connect(planet, SIGNAL(gameInfoRecieved(const Planet &, const QList<Game> &)), this, SLOT(processPlanetGames(const Planet &, const QList<Game> &)));
    connect(planet, SIGNAL(error(const Planet &, QAbstractSocket::SocketError)), this, SLOT(setPlanetConnectionError(const Planet &, QAbstractSocket::SocketError)));
    connect(planet, SIGNAL(errorCleared(const Planet &)), this, SLOT(clearPlanetConnectionError(const Planet &)));
    planetList << planet;
    QList<QStandardItem*> planetRow;
    QStandardItem* address = new QStandardItem(QString("%1:%2").arg(planet->getAddress()).arg(planet->getPort()));
    planetTreeModel->setItemType(address, PlanetTreeModel::ItemType::Planet);
    QStandardItem* error = new QStandardItem();
    planetRow << address << error;
    planetTreeModel->invisibleRootItem()->appendRow(planetRow);
    resizeColumnsToContents();
    refreshPlanets();
}
Esempio n. 30
0
CSVWorld::RegionMap::RegionMap (const CSMWorld::UniversalId& universalId,
                                CSMDoc::Document& document, QWidget *parent)
    :  DragRecordTable(document, parent)
{
    verticalHeader()->hide();
    horizontalHeader()->hide();

    setSelectionMode (QAbstractItemView::ExtendedSelection);

    setModel (document.getData().getTableModel (universalId));

    resizeColumnsToContents();
    resizeRowsToContents();

    mSelectAllAction = new QAction (tr ("Select All"), this);
    connect (mSelectAllAction, SIGNAL (triggered()), this, SLOT (selectAll()));
    addAction (mSelectAllAction);

    mClearSelectionAction = new QAction (tr ("Clear Selection"), this);
    connect (mClearSelectionAction, SIGNAL (triggered()), this, SLOT (clearSelection()));
    addAction (mClearSelectionAction);

    mSelectRegionsAction = new QAction (tr ("Select Regions"), this);
    connect (mSelectRegionsAction, SIGNAL (triggered()), this, SLOT (selectRegions()));
    addAction (mSelectRegionsAction);

    mCreateCellsAction = new QAction (tr ("Create Cells Action"), this);
    connect (mCreateCellsAction, SIGNAL (triggered()), this, SLOT (createCells()));
    addAction (mCreateCellsAction);

    mSetRegionAction = new QAction (tr ("Set Region"), this);
    connect (mSetRegionAction, SIGNAL (triggered()), this, SLOT (setRegion()));
    addAction (mSetRegionAction);

    mUnsetRegionAction = new QAction (tr ("Unset Region"), this);
    connect (mUnsetRegionAction, SIGNAL (triggered()), this, SLOT (unsetRegion()));
    addAction (mUnsetRegionAction);

    mViewAction = new QAction (tr ("View Cells"), this);
    connect (mViewAction, SIGNAL (triggered()), this, SLOT (view()));
    addAction (mViewAction);

    mViewInTableAction = new QAction (tr ("View Cells in Table"), this);
    connect (mViewInTableAction, SIGNAL (triggered()), this, SLOT (viewInTable()));
    addAction (mViewInTableAction);

    setAcceptDrops(true);
}