void API::showTables(){ Table table; vector<vector<char>> returnRecord; rmanager.getAllRecord("table.catalog", table.recordSize, returnRecord); vector<int> type; type.push_back(53); vector<string> title; title.push_back("Tables_in_miniSQL"); cout << showTable(returnRecord, type, title) << " rows in set." << endl; }
void OutputItemContentWidget::refreshOutputItem() { switch(_viewMode) { case Text: showText(); break; case Tree: showTree(); break; case Table: showTable(); break; case Custom: showCustom(); break; default: showTree(); } }
void TableViewPanel::registerControl(NodeModel *nodeModel, SceneModel *sceneModel) { QObject::connect(nodeModel, SIGNAL(nodeSelected(Node *)), this, SLOT(showTable(Node *))); // display the parameters of the first selected node in the new table panel QStringList selectedNodes = sceneModel->getSelectedObjects(); if (selectedNodes.size() > 0) { Node *selectedNode = nodeModel->getNode(selectedNodes.at(0)); showTable(selectedNode); } }
void Loser() { loseTimes++; int count=1; Image *loser; int ran,i; srand( time(NULL) ); ran=rand()%2; while(count<=6) { clearScreen(); switch(count) { case 1: loser= read_image("Loser1.pixel","Loser1.color"); break; case 2: loser= read_image("Loser2.pixel","Loser2.color"); break; case 3: loser= read_image("Loser3.pixel","Loser3.color"); break; case 4: loser= read_image("Loser4.pixel","Loser4.color"); break; case 5: loser= read_image("Loser5.pixel","Loser5.color"); break; case 6: loser= read_image("Loser6.pixel","Loser6.color"); default: break; } count++; show_image(loser,120,35); drawCmdWindow(); /* update window immediately */ for(i=0; i<1; i++) { playAudio(&audioLose[ran]); //Sleep(100); } Sleep(300); } destroy_image(loser); showTable(); }
/** * This method deletes a column from the table * * @param item */ void TableMainWindow::deleteColumn(int item){ if(p_table == NULL) { std::cout << "deleteColumn err" << std::endl; return; } p_itemList.removeAt(item); p_table->setColumnCount(p_table->columnCount() -1); p_itemList.clear(); bool vis = p_table->isVisible(); p_table = NULL; p_listWidget = NULL; this->close(); if(vis) showTable(); }
/* 功 能:显示内存里的记录信息。 参 数:无 返 回 值:void 工作方式:从头部开始逐个显示记录内容, 没有记录则 打印 "没有记录" */ void disPlay() { system("cls"); // 清屏 PRHEAD; rank_Refresh(); printf(" 显示学生信息: \n\n"); showTable(); int i = 0; while(records[i].savetag == 1) { PR(i); i++; } if(i == 0) printf("没有记录!\n"); }
// Добавил make file с опцией для линковщика, чтобы подключить мат. функции int main(void) { double sinTable[period]; double angle = 0; double angleStep = (double) 2 * pi / period; double temp = 0; int i = 0; for(i = 0; i < period; i++, angle +=angleStep ) { temp = sin(angle); temp = temp > 0 ? temp * amplitude : 0; sinTable[i] = temp; } showTable(sinTable); return EXIT_SUCCESS; }
int ImportDiagram::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = Q3MainWindow::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: createMdiChild(); break; case 1: timerEvent(); break; case 2: showTable(); break; case 3: showSelector(); break; case 4: screenshort(); break; case 5: refresh(); break; case 6: backcolor(); break; case 7: legendIsClicked((*reinterpret_cast< QwtPlotItem*(*)>(_a[1]))); break; case 8: onAutoscale((*reinterpret_cast< int(*)>(_a[1]))); break; default: ; } _id -= 9; } return _id; }
/* 功能:根据指定的序号显示出记录信息 参数:index,指定的序号 返回:void 指定的序号不存在时给出找不到的信息 */ void index_disPlay(int index) { int count = countRecords(); if( index > count ) // 输入不合法时 { printf("内存中没有该杀记录!\n"); } else if( index < 1 ) // 输入不合法时 printf("给定的序号不能为0或负数!\n"); else { if(records[index-1].savetag == 1) { showTable(); PR(index-1); // 宏定义 } else { printf("内存中没有该杀记录!\n"); // 找不到时相应处理 } } }
Type *checkProcDec(Absyn * node, Table * symtab) { Table *localSymtab; Entry *entry; // loopup procs local symtable here entry = lookup(symtab, node->u.procDec.name); localSymtab = entry->u.procEntry.localTable; // compute local declarations checkNode(node->u.procDec.decls, localSymtab); // compute procedure body checkNode(node->u.procDec.body, localSymtab); // optional debug output if (local_debug) { printf("symbol table at end of procedure '%s':\n", symToString(node->u.procDec.name)); showTable(localSymtab); } return NULL; }
void Select() { char s[1000]; gets(s); upper_change(s);///There, we change the string alphabat to upper. //puts(s);///转换检测 SQL *sql=new SQL(s); if (sql->Get(sql->GetSize()-1) != ";") {cout<<"plz use ; to the end."<<endl; return ;} if (sql->Get(0) == "exit"){cout<<"ByeBye~"<<endl; exit(0);} if (!sql->Judge()) return ; if (sql->Get(0) == "create" && sql->Get(1) == "table") createTable(sql);//create table s (num int ,name char(10)) else if(sql->Get(0) == "insert" && sql->Get(1) == "into" && sql->Get(3) == "values") insertRecord(sql);//insert into s values () else if (sql->Get(0) == "show") showTable(sql->Get(1)); //show s else if (sql->Get(0) == "drop" && sql->Get(1) == "table") dropTable (sql->Get(2));//drop table s else if (sql->Get(0) =="alter" && sql->Get(1) == "table") alterTable (sql);//alter table s (add name type)/(drop name type) else if (sql->Get(0) =="delete" && sql->Get(1) == "from" && sql->Get(3) == "where") deleteRecord(sql);//delete from s while name = name1 else cout << "The code is error!" << endl; }
MainWindow::MainWindow() { QMenu *fileMenu = new QMenu(tr("&File")); QAction *saveAction = fileMenu->addAction(tr("&Save...")); saveAction->setShortcut(tr("Ctrl+S")); QAction *quitAction = fileMenu->addAction(tr("E&xit")); quitAction->setShortcut(tr("Ctrl+Q")); QMenu *showMenu = new QMenu(tr("&Show")); QAction *showTableAction = showMenu->addAction(tr("&Table")); menuBar()->addMenu(fileMenu); menuBar()->addMenu(showMenu); editor = new QTextEdit(); //! [0] //! [1] QTextCursor cursor(editor->textCursor()); //! [0] cursor.movePosition(QTextCursor::Start); //! [1] int rows = 11; int columns = 4; //! [2] QTextTableFormat tableFormat; tableFormat.setBackground(QColor("#e0e0e0")); QVector<QTextLength> constraints; constraints << QTextLength(QTextLength::PercentageLength, 16); constraints << QTextLength(QTextLength::PercentageLength, 28); constraints << QTextLength(QTextLength::PercentageLength, 28); constraints << QTextLength(QTextLength::PercentageLength, 28); tableFormat.setColumnWidthConstraints(constraints); //! [3] QTextTable *table = cursor.insertTable(rows, columns, tableFormat); //! [2] //! [3] int column; int row; QTextTableCell cell; QTextCursor cellCursor; QTextCharFormat charFormat; charFormat.setForeground(Qt::black); //! [4] cell = table->cellAt(0, 0); cellCursor = cell.firstCursorPosition(); cellCursor.insertText(tr("Week"), charFormat); //! [4] //! [5] for (column = 1; column < columns; ++column) { cell = table->cellAt(0, column); cellCursor = cell.firstCursorPosition(); cellCursor.insertText(tr("Team %1").arg(column), charFormat); } for (row = 1; row < rows; ++row) { cell = table->cellAt(row, 0); cellCursor = cell.firstCursorPosition(); cellCursor.insertText(tr("%1").arg(row), charFormat); for (column = 1; column < columns; ++column) { if ((row-1) % 3 == column-1) { //! [5] //! [6] cell = table->cellAt(row, column); QTextCursor cellCursor = cell.firstCursorPosition(); cellCursor.insertText(tr("On duty"), charFormat); } //! [6] //! [7] } //! [7] //! [8] } //! [8] connect(saveAction, SIGNAL(triggered()), this, SLOT(saveFile())); connect(quitAction, SIGNAL(triggered()), this, SLOT(close())); connect(showTableAction, SIGNAL(triggered()), this, SLOT(showTable())); setCentralWidget(editor); setWindowTitle(tr("Text Document Tables")); }
int main() { struct dbSysHead head; long fid1, fid2; /* ≥ı ºªØ£¨»ª∫Û¥Ú”°≥ˆµ±«∞œµÕ≥µƒ–≈œ¢ */ init_database(&head); showDesc(&head); // printf("create file1...\n"); fid1 = creatFileSpace(&head);//Œ™Œƒº˛“ª∑÷≈‰ø’º‰ fid2 = creatFileSpace(&head); // showFileDesc(&head); /* printf("extend 10 pages for file1...\n"); extendFileSpace(&head, fid1, 10);//¿©’π Æ“≥ showFileDesc(&head); printf("extend 10 pages for file1...\n"); extendFileSpace(&head, fid1, 10);//‘Ÿ¿©’π Æ“≥ showFileDesc(&head); printf("create file2...\n"); fid2 = creatFileSpace(&head); showFileDesc(&head); printf("extend 10 pages for file2...\n"); extendFileSpace(&head, fid2, 10); showFileDesc(&head); printf("extend 10 pages for file2...\n"); extendFileSpace(&head, fid2, 10); showFileDesc(&head); printf("delete file1...\n"); recyFileSpace(&head, fid1); showFileDesc(&head); printf("delete file2...\n"); recyFileSpace(&head, fid2); showFileDesc(&head);*/ //use dictID to scan file1 /* int dictID = 1; int scanPointer = 0; int rec_length = head.redef[dictID].getRecordLength(); printf("attributeName::%s", head.redef[dictID].getAttributeByNo(0).getName()); RecordCursor scanTable(&head, 1, rec_length, 0); char * one_Row_ = (char *)malloc(sizeof(char)*rec_length); while (true == scanTable.getNextRecord(one_Row_)) { //only scan scanPointer ++; if(scanPointer > 230) getOneRecord(one_Row_, head.redef[dictID]); //get each attribute value and print } free(one_Row_); */ // if(initTable(&head, fid1) == 0) if(initTable(&head, FIRST_FID) == 0) printf("1 initTable: customer.tbl\n"); if(showTable(&head, "customer") == -1 ) printf("2 showTable: customer\n"); if(initTable(&head, FIRST_FID+1) == 0) printf("1 initTable: nation.tbl\n"); if(showTable(&head, "nation") == -1 ) printf("2 showTable: nation\n"); //read customer.tbl and write into our file1, 一次性 loaddata(&head, FIRST_FID); //Scan Table relation * temp_data_dict = new relation[MAX_FILE_NUM]; TableScan(&head, FIRST_FID, temp_data_dict); //get the output of tablescan, temporarily according to datadict1, other than temp_data_dict[1] int buffer_ID_ = - temp_data_dict[0].fileID; //find which buffer int record_num_ = temp_data_dict[0].getRecordNum(); int record_len_ = temp_data_dict[0].getRecordLength(); // RecordCursorTmp t1(&head,1,record_len_,buffer_ID_,record_num_); cout<<buffer_ID_<<"~"<<record_len_<<"~"<<record_num_<<endl; /* int scanPointer = 0; int dictID = queryFileID(&head, FIRST_FID); char * one_Row_ = (char *)malloc(sizeof(char)*record_len_); while (true == t1.getNextRecord(one_Row_)) { //only scan scanPointer ++; if(scanPointer < 20) getOneRecord(one_Row_, &head.redef[dictID]); //get each attribute value and print } free(one_Row_);*/ loaddata(&head, FIRST_FID + 1); TableScan(&head, FIRST_FID + 1, temp_data_dict); //get the output of tablescan, temporarily according to datadict1, other than temp_data_dict[1] buffer_ID_ = - temp_data_dict[1].fileID; //find which buffer record_num_ = temp_data_dict[1].getRecordNum(); record_len_ = temp_data_dict[1].getRecordLength(); // RecordCursorTmp t2(&head,1,record_len_,buffer_ID_,record_num_); cout<<buffer_ID_<<"~"<<record_len_<<"~"<<record_num_<<endl; /* scanPointer = 0; dictID = queryFileID(&head, FIRST_FID + 1); char * one_Row_2 = (char *)malloc(sizeof(char)*record_len_); while (true == t2.getNextRecord(one_Row_2)) { //only scan scanPointer ++; if(scanPointer < 20) getOneRecord(one_Row_2, &head.redef[dictID]); //get each attribute value and print } free(one_Row_2);*/ // create index /* printf("recordNum:%d\n",head.redef[dictID].recordNum); if(true == createIndexOn(&head, 1, "custkey")){ char* index_filename= "b_plus_tree_index_1custkey.dat"; FILE* fp = fopen(index_filename,"rb+"); printf("search(fp,-10):%d\n",search(fp,-10)); printf("search(fp,1):%d\n",search(fp,1)); printf("search(fp,2):%d\n",search(fp,2)); printf("search(fp,50):%d\n",search(fp,50)); display(fp); fclose(fp); } // insert one record relationDefine dic = head.redef[0]; int size_per_record = dic.recordLength; char *oneRec = (char *)malloc(sizeof(char)*size_per_record); char * insertTest = (char *)malloc(sizeof(char)* 256); strcpy(insertTest,"501|Customer#000000001|IVhzIApeRb ot,c,E|15|25-989-741-2988|711.56|BUILDING|to the even, regular platelets. regular, ironic epitaphs nag eHHHHHH|"); parserOneLineFromFile(insertTest, oneRec, dic); insertOneRecord(&head, 1, oneRec);//≤»ΓªÃı ˝æ›£¨◊‘∂Ø∏¸–¬À˜“˝ free(insertTest); free(oneRec); // look up key in index char* index_filename= "b_plus_tree_index_1custkey.dat"; FILE* fp = fopen(index_filename,"rb+"); int pos = search(fp,501); printf("pos:::%d\n",pos); fclose(fp); one_Row_ = (char *)malloc(sizeof(char)*rec_length); rdFile( &head, 0, 1, pos, rec_length,one_Row_); printf("reading from index:\n"); getOneRecord(one_Row_, dic); */ /* relation result; result.init("customer", "TianzhenWu"); result.insertAttribute("name", 2, 64); result.insertAttribute("phone", 2, 64); showRelation(&result); project(&head, &temp_data_dict[0], &result);********/ printf("start tableScanEqualFilter()...\n"); // if(true == tableScanEqualFilter(&head, FIRST_FID, temp_data_dict,"custkey","3",&temp_data_dict[5])){ // printf("tableScanEqualFilter()\n"); // } /* if(true == tableScanEqualFilter(&head, FIRST_FID, temp_data_dict,"name","Customer#000000009",&temp_data_dict[5])){ printf("tableScanEqualFilter()\n"); } buffer_ID_ = - temp_data_dict[5].fileID; //find which buffer record_num_ = temp_data_dict[5].getRecordNum(); record_len_ = temp_data_dict[5].getRecordLength(); RecordCursorTmp t2(&head,1,record_len_,buffer_ID_,record_num_); cout<<buffer_ID_<<"~"<<record_len_<<"~"<<record_num_<<endl; one_Row_ = (char *)malloc(sizeof(char)*record_len_); while (true == t2.getNextRecord(one_Row_)) { //only scan getOneRecord(one_Row_, &temp_data_dict[5]); //get each attribute value and print } free(one_Row_); //head.buff[buffer_ID_].emptyOrnot = false; */ if(true == tableScanScopeFilter(&head, FIRST_FID, temp_data_dict,"custkey","220",NOT_MORE_THAN,"230",LESS_THAN,&temp_data_dict[5])){ printf("tableScanScopeFilter()\n"); } buffer_ID_ = - temp_data_dict[5].fileID; //find which buffer record_num_ = temp_data_dict[5].getRecordNum(); record_len_ = temp_data_dict[5].getRecordLength(); RecordCursorTmp t2(&head,1,record_len_,buffer_ID_,record_num_); cout<<buffer_ID_<<"~"<<record_len_<<"~"<<record_num_<<endl; char *one_Row_ = (char *)malloc(sizeof(char)*record_len_); while (true == t2.getNextRecord(one_Row_)) { //only scan getOneRecord(one_Row_, &temp_data_dict[5]); //get each attribute value and print } free(one_Row_); //head.buff[buffer_ID_].emptyOrnot = false; showFileDesc(&head); exit_database(&head); system("pause"); return 0; }
void TestSqliteController::onShowTable(yhge::Event* event) { CCLOG("####show table#####"); showTable(); }
/* 功 能:按要求查询指定学生信息 菜单函数 参 数:无 返 回 值:void 工作方式:可以按照学号、姓名或名次来查询。 */ void queryInfo() { do { system("cls"); // 清屏 int choice; //菜单选择参数 char name[20]; char num[15]; int rank; int index; PRHEAD; printf(" 查询学生记录\n\n\n"); printf(" 1. 按学号查询\n\n"); printf(" 2. 按姓名查询\n\n"); printf(" 3. 按名次查询\n\n"); printf(" 0. 返回主菜单\n\n"); choice = menu_select(0,3); printf("\n"); switch(choice) { case 1: printf("请输入学号:"); scanf("%s", num); //输入要查询的学号 index = num_findRecord(num, 0); printf("\n"); if(index == -1) // 若index为-1则表示没有找到指定的记录 printf("没有找到相关记录!\n"); else { showTable(); PR(index-1); //宏定义, 将查询到的信息打印出来 } break; case 2: printf("请输入姓名:"); scanf("%s", name); //输入要查询的姓名 index = name_findRecord(name, 0); printf("\n"); if(index == -1) printf("没有找到相关记录!\n"); else { showTable(); PR(index-1); //宏定义, 将查询到的信息打印出来 } break; case 3: printf("请输入名次:"); scanf("%d", &rank); // 输入要查询的名次 index = rank_findRecord(rank, 0); printf("\n"); if(index == -1) printf("没有找到相关记录!\n"); else { showTable(); PR(index-1); //宏定义, 将查询到的信息打印出来 } break; case 0: break; } printf("\n是否继续查询(y/n)? "); }while(isContinue()); }
void DataBaseTab::handleDoubleClicked(QModelIndex index) { QString tableName = ((DatabaseModel *)this->model())->getTableName(index.row()); emit showTable(tableName); }
OutputItemHeaderWidget::OutputItemHeaderWidget( OutputItemContentWidget *outputItemContentWidget, bool multipleResults, bool tabbedResults, bool firstItem, bool lastItem, QWidget *parent) : QFrame(parent), _maxButton(nullptr), _dockUndockButton(nullptr), _maximized(false), _multipleResults(multipleResults), _firstItem(firstItem), _lastItem(lastItem), _orientation(Qt::Vertical) { setContentsMargins(5, 0, 0, 0); auto const* outputWidget = qobject_cast<OutputWidget*>(outputItemContentWidget->parentWidget()); _orientation = outputWidget->getOrientation(); // Text mode button _textButton = new QPushButton(this); _textButton->setIcon(GuiRegistry::instance().textIcon()); _textButton->setToolTip("View results in text mode"); _textButton->setFixedSize(24, 24); _textButton->setFlat(true); _textButton->setCheckable(true); // Tree mode button _treeButton = new QPushButton(this); _treeButton->hide(); _treeButton->setIcon(GuiRegistry::instance().treeIcon()); _treeButton->setToolTip("View results in tree mode"); _treeButton->setFixedSize(24, 24); _treeButton->setFlat(true); _treeButton->setCheckable(true); _treeButton->setChecked(true); // Table mode button _tableButton = new QPushButton(this); _tableButton->hide(); _tableButton->setIcon(GuiRegistry::instance().tableIcon()); _tableButton->setToolTip("View results in table mode"); _tableButton->setFixedSize(24, 24); _tableButton->setFlat(true); _tableButton->setCheckable(true); _tableButton->setChecked(true); // Custom mode button _customButton = new QPushButton(this); _customButton->hide(); _customButton->setIcon(GuiRegistry::instance().customIcon()); _customButton->setToolTip("View results in custom UI"); _customButton->setFixedSize(24, 24); _customButton->setFlat(true); _customButton->setCheckable(true); // Create maximize button only if there are multiple results if (_multipleResults && !tabbedResults) { _maxButton = new QPushButton; _maxButton->setIcon(GuiRegistry::instance().maximizeIcon()); _maxButton->setToolTip("Maximize this output result (double-click on result's header)"); _maxButton->setFixedSize(18, 18); _maxButton->setFlat(true); VERIFY(connect(_maxButton, SIGNAL(clicked()), this, SLOT(maximizeMinimizePart()))); } auto dockWidget = qobject_cast<QueryWidget::CustomDockWidget*>(outputItemContentWidget->parentWidget()->parentWidget()); auto queryWidget = dockWidget->getParentQueryWidget(); _dockUndockButton = new QPushButton; _dockUndockButton->setFixedSize(18, 18); _dockUndockButton->setFlat(true); _dockUndockButton->setHidden(true); applyDockUndockSettings(!dockWidget->isFloating()); VERIFY(connect(_dockUndockButton, SIGNAL(clicked()), queryWidget, SLOT(dockUndock()))); VERIFY(connect(_textButton, SIGNAL(clicked()), outputItemContentWidget, SLOT(showText()))); VERIFY(connect(_treeButton, SIGNAL(clicked()), outputItemContentWidget, SLOT(showTree()))); VERIFY(connect(_tableButton, SIGNAL(clicked()), outputItemContentWidget, SLOT(showTable()))); VERIFY(connect(_customButton, SIGNAL(clicked()), outputItemContentWidget, SLOT(showCustom()))); _collectionIndicator = new Indicator(GuiRegistry::instance().collectionIcon()); _timeIndicator = new Indicator(GuiRegistry::instance().timeIcon()); _paging = new PagingWidget(); _collectionIndicator->hide(); _timeIndicator->hide(); _paging->hide(); QHBoxLayout *layout = new QHBoxLayout(); #ifdef __APPLE__ layout->setContentsMargins(2, 8, 5, 1); #else layout->setContentsMargins(2, 0, 5, 1); #endif layout->setSpacing(0); layout->addWidget(_collectionIndicator); layout->addWidget(_timeIndicator); QSpacerItem *hSpacer = new QSpacerItem(2000, 24, QSizePolicy::Preferred, QSizePolicy::Minimum); layout->addSpacerItem(hSpacer); layout->addWidget(_paging); layout->addWidget(createVerticalLine()); layout->addSpacing(2); if (outputItemContentWidget->isCustomModeSupported()) { layout->addWidget(_customButton, 0, Qt::AlignRight); _customButton->show(); } if (outputItemContentWidget->isTreeModeSupported()) { layout->addWidget(_treeButton, 0, Qt::AlignRight); _treeButton->show(); } if (outputItemContentWidget->isTableModeSupported()) { layout->addWidget(_tableButton, 0, Qt::AlignRight); _tableButton->show(); } if (outputItemContentWidget->isTextModeSupported()) layout->addWidget(_textButton, 0, Qt::AlignRight); if (_multipleResults) layout->addWidget(_maxButton, 0, Qt::AlignRight); layout->addSpacing(3); _verticalLine = createVerticalLine(); _verticalLine->setHidden(true); layout->addWidget(_verticalLine); layout->addWidget(_dockUndockButton); setLayout(layout); // Update dock/undock button visibility if (_multipleResults) updateDockButtonOnToggleOrientation(); else { _verticalLine->setVisible(true); _dockUndockButton->setVisible(true); } if(tabbedResults) setStyleSheet("background-color: white"); }
OutputItemHeaderWidget::OutputItemHeaderWidget(OutputItemContentWidget *output, QWidget *parent) : QFrame(parent), _maximized(false) { setContentsMargins(5,0,0,0); // Maximize button _maxButton = new QPushButton; _maxButton->setIcon(GuiRegistry::instance().maximizeIcon()); _maxButton->setToolTip("Maximize or restore back this output result. You also can double-click on result's header."); _maxButton->setFixedSize(18, 18); _maxButton->setFlat(true); VERIFY(connect(_maxButton, SIGNAL(clicked()), this, SLOT(maximizePart()))); // Text mode button _textButton = new QPushButton(this); _textButton->setIcon(GuiRegistry::instance().textIcon()); _textButton->setToolTip("View results in text mode"); _textButton->setFixedSize(24, 24); _textButton->setFlat(true); _textButton->setCheckable(true); // Tree mode button _treeButton = new QPushButton(this); _treeButton->hide(); _treeButton->setIcon(GuiRegistry::instance().treeIcon()); _treeButton->setToolTip("View results in tree mode"); _treeButton->setFixedSize(24, 24); _treeButton->setFlat(true); _treeButton->setCheckable(true); _treeButton->setChecked(true); // Table mode button _tableButton = new QPushButton(this); _tableButton->hide(); _tableButton->setIcon(GuiRegistry::instance().tableIcon()); _tableButton->setToolTip("View results in table mode"); _tableButton->setFixedSize(24, 24); _tableButton->setFlat(true); _tableButton->setCheckable(true); _tableButton->setChecked(true); // Custom mode button _customButton = new QPushButton(this); _customButton->hide(); _customButton->setIcon(GuiRegistry::instance().customIcon()); _customButton->setToolTip("View results in custom UI"); _customButton->setFixedSize(24, 24); _customButton->setFlat(true); _customButton->setCheckable(true); VERIFY(connect(_textButton, SIGNAL(clicked()), output, SLOT(showText()))); VERIFY(connect(_treeButton, SIGNAL(clicked()), output, SLOT(showTree()))); VERIFY(connect(_tableButton, SIGNAL(clicked()), output, SLOT(showTable()))); VERIFY(connect(_customButton, SIGNAL(clicked()), output, SLOT(showCustom()))); _collectionIndicator = new Indicator(GuiRegistry::instance().collectionIcon()); _timeIndicator = new Indicator(GuiRegistry::instance().timeIcon()); _paging = new PagingWidget(); _collectionIndicator->hide(); _timeIndicator->hide(); _paging->hide(); QHBoxLayout *layout = new QHBoxLayout(); layout->setContentsMargins(2, 0, 5, 1); layout->setSpacing(0); layout->addWidget(_collectionIndicator); layout->addWidget(_timeIndicator); QSpacerItem *hSpacer = new QSpacerItem(2000, 24, QSizePolicy::Preferred, QSizePolicy::Minimum); layout->addSpacerItem(hSpacer); layout->addWidget(_paging); layout->addWidget(createVerticalLine()); layout->addSpacing(2); if (output->isCustomModeSupported()) { layout->addWidget(_customButton, 0, Qt::AlignRight); _customButton->show(); } if (output->isTreeModeSupported()) { layout->addWidget(_treeButton, 0, Qt::AlignRight); _treeButton->show(); } if (output->isTableModeSupported()) { layout->addWidget(_tableButton, 0, Qt::AlignRight); _tableButton->show(); } if (output->isTextModeSupported()) layout->addWidget(_textButton, 0, Qt::AlignRight); layout->addSpacing(3); layout->addWidget(createVerticalLine()); layout->addWidget(_maxButton, 0, Qt::AlignRight); setLayout(layout); }