本文整理汇总了C++中QScrollArea::setHorizontalScrollBarPolicy方法的典型用法代码示例。如果您正苦于以下问题:C++ QScrollArea::setHorizontalScrollBarPolicy方法的具体用法?C++ QScrollArea::setHorizontalScrollBarPolicy怎么用?C++ QScrollArea::setHorizontalScrollBarPolicy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QScrollArea
的用法示例。
在下文中一共展示了QScrollArea::setHorizontalScrollBarPolicy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
int flag=0,flag1=0;
FILE* fp;
fp=fopen("counter.txt","r");
if(fp==NULL)
{
flag=1;
}
else
fclose(fp);
if(flag==1)
{
int k=1;
fp=fopen("counter.txt","w");
fprintf(fp,"%i",k);
fclose(fp);
}
else
{
iput.open("counter.txt");
int count;
iput>>count;
iput.close();
if(count>=updateCounter)
{
// callFileList();
flag1=1;
count=-1;
}
count++;
fp=fopen("counter.txt","w+");
fprintf(fp,"%i",count);
fclose(fp);
}
if(flag1==1 || flag==1)
{
fileList f1;
f1.runner();
}
/********************Reading files in Prefix -trie********************************/
Btree b1;
b1.takeInput(str1);
tries t2;
callPrefixTrie(t2);
/*************************history trie*****************************************/
tries t1;
callHistoryTrie(t1);
/**************************************************************/
string str;
cout<<"enter the string :"<<endl;
//cin>>str;
//vector<fax*> inputVector;
//inputVector=process(str,t2,t1,n);
/* for(int i=0;i<star.size();i++)
{
cout<<star[i]->nam<<endl;
}
*/
/* fax* fax1=new fax("rhythmbox-client","##");
show(fax1,t2,t1);
onClose(t1);
*/
//##########################################################################3
w->startArena(t1,t2, 15);
QScrollArea scrollarea;
scrollarea.setWidget(w);
scrollarea.setWidgetResizable(true);
scrollarea.viewport()->setBackgroundRole(QPalette::Dark);
scrollarea.viewport()->setAutoFillBackground(true);
scrollarea.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
scrollarea.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
scrollarea.setWindowTitle(QObject::tr("arena"));
scrollarea.show();
//w->show();
return a.exec();
}
示例2: if
ValidationResultDialog::ValidationResultDialog(ValidationItem* item)
{
//return if there's no parent
if (item == NULL)
{
return;
}
QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok,Qt::Horizontal, this);
QPushButton* print_button = new QPushButton("Save to File", buttons);
QVBoxLayout* mainLayout = new QVBoxLayout();
QGroupBox* resultGroup = new QGroupBox(tr("Validation Results"),this);
QGridLayout* layout = new QGridLayout();
QVBoxLayout* resultGroupLayout = new QVBoxLayout();
int type = item->getValidationType();
if (type < 4 || type==5)
{
String train_fit ="R^2";
String pred_qual="Q^2";
String n = item->modelItem()->getRegistryEntry()->getStatName(item->getValidationStatistic());
if(n!="")
{
train_fit = n+"<br>on training data";
pred_qual = "predictive<br>"+n;
}
QLabel* rlabel = new QLabel(train_fit.c_str(),this);
layout->addWidget(rlabel, 0,1);
QString tmp;
QLabel* qlabel=NULL;
if(type<3)
{
qlabel = new QLabel(tmp.setNum(item->k())+ " fold "+pred_qual.c_str(),this);
}
else if(type==3) // boostrap
{
qlabel = new QLabel(QString(pred_qual.c_str())+" of "+tmp.setNum(item->numOfSamples())+ "\nbootstrap samples",this);
}
else if(type==5)
{
qlabel = new QLabel(tmp.setNum(item->getNoExternalFolds())+ " fold nested "+pred_qual.c_str(),this);
}
layout->addWidget(qlabel, 0,2);
QLabel* rvaluelabel = new QLabel(QString(((String)(item->getR2())).c_str()),this);
layout->addWidget(rvaluelabel,1,1);
QLabel* qvaluelabel = new QLabel(QString(((String)(item->getQ2())).c_str()),this);
layout->addWidget(qvaluelabel,1,2);
resultGroup->setLayout(layout);
}
else if (type == 4)
{
QString value;
float num;
QStringList labels;
labels << "# Tests" << "R^2" << "Q^2";
QTableWidget* table = new QTableWidget(item->resultOfRandTest()->rows(), 3, this);
table->verticalHeader()->hide();
table->setHorizontalHeaderLabels (labels);
table->setAlternatingRowColors(true);
table->setDragDropMode(QAbstractItemView::NoDragDrop);
table->setEditTriggers(QAbstractItemView::NoEditTriggers);
table->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
table->horizontalHeader()->setResizeMode(2,QHeaderView::Stretch);
for (int i = 0; i < item->resultOfRandTest()->rows();i++)
{
value.setNum(i);
QTableWidgetItem* num_of_Test = new QTableWidgetItem(value);
table->setItem(i, 0, num_of_Test);
num = (*(item->resultOfRandTest()))(i,item->resultOfRandTest()->cols()-2);
value.setNum(num);
QTableWidgetItem* r = new QTableWidgetItem(value);
table->setItem(i, 1, r);
num = (*(item->resultOfRandTest()))(i,item->resultOfRandTest()->cols()-1);
value.setNum(num);
QTableWidgetItem* q = new QTableWidgetItem(value);
table->setItem(i, 2, q);
}
QScrollArea* scrollArea = new QScrollArea(this);
scrollArea->setHorizontalScrollBarPolicy ( Qt::ScrollBarAlwaysOff );
scrollArea->setVerticalScrollBarPolicy ( Qt::ScrollBarAsNeeded );
scrollArea->setFrameShape(QFrame::NoFrame);
scrollArea->setWidget(table);
scrollArea->setWidgetResizable(true);
resultGroupLayout->addWidget(scrollArea);
resultGroup->setLayout(resultGroupLayout);
//.........这里部分代码省略.........
示例3: mousePressEvent
void QtUnit::mousePressEvent(QMouseEvent *event)
{
if (event->button() != Qt::LeftButton)
return;
printf("[0x%08x] a=[%d,%d] p=[%d,%d] l=[%d,%d]\n",
node, node->WasActive(), node->IsActive(),
node->WasPredicted(), node->IsPredicted(),
node->WasLearning(), node->IsLearning()
);
if (!this->IsClickable())
return;
QVBoxLayout *objGroupLayout = new QVBoxLayout();
QScrollArea *objScroll = new QScrollArea(objDetail);
objScroll->setStyleSheet("background-color: rgb(25, 25, 25);");
objScroll->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
objScroll->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
QWidget *scrollChild = new QWidget();
QGridLayout *objGrid = new QGridLayout(scrollChild);
objGrid->setSizeConstraint(QLayout::SetMinAndMaxSize);
QLayout *currentLayout = NULL;
QLayoutItem *child = NULL;
if (objDetail) {
if ((currentLayout = objDetail->layout())) {
while ((child = currentLayout->takeAt(0)) != 0)
delete child->widget();
delete currentLayout;
}
}
objGroupLayout->addWidget(objScroll);
QLabel *columnPosLab = new QLabel("position: ");
int colx = ((Column *)node)->GetX();
int coly = ((Column *)node)->GetY();
char posbuf[32];
snprintf(posbuf, sizeof(posbuf), "(%d,%d)", colx, coly);
QLabel *columnPosVal = new QLabel(posbuf);
objGrid->addWidget(columnPosLab, 0, 0);
objGrid->addWidget(columnPosVal, 0, 1);
QLabel *overlapLab = new QLabel("overlap: ");
QLabel *overlapVal = new QLabel(QString::number(((Column *)node)->GetOverlap()));
objGrid->addWidget(overlapLab, 1, 0);
objGrid->addWidget(overlapVal, 1, 1);
QLabel *synapsesLab = new QLabel("synaptic details");
objGrid->addWidget(synapsesLab, 2, 0, 1, 3);
QLabel *idx = new QLabel("Idx");
QLabel *coord = new QLabel("Coord");
QLabel *firing = new QLabel("Firing");
QLabel *perm = new QLabel("Perm");
objGrid->addWidget(idx, 3, 0);
objGrid->addWidget(coord, 3, 1);
objGrid->addWidget(firing, 3, 2);
objGrid->addWidget(perm, 3, 3);
Column *col = (Column *)node;
DendriteSegment *segment = col->GetProximalDendriteSegment();
std::vector<Synapse *> syns = segment->GetSynapses();
for (int i=0; i<col->GetRecFieldSz(); i++) {
char synCoordStr[32];
memset(synCoordStr, 0, sizeof(synCoordStr));
int x = syns[i]->GetX(), y = syns[i]->GetY();
snprintf(synCoordStr, sizeof(synCoordStr), "(%d, %d)", x, y);
float p = syns[i]->GetPerm();
QLabel *synIdx = new QLabel(QString("%1: ").arg(i));
QLabel *synCoordLab = new QLabel(synCoordStr);
QLabel *synFiring = new QLabel(QString("%1").arg(syns[i]->IsFiring()? 1 : 0));
QLabel *synPerm = new QLabel(QString("%1: ").arg(p));
objGrid->addWidget(synIdx, 4+i, 0, 1, 1);
objGrid->addWidget(synCoordLab, 4+i, 1, 1, 1);
objGrid->addWidget(synFiring, 4+i, 2, 1, 1);
objGrid->addWidget(synPerm, 4+i, 3, 1, 1);
}
// Note: must add the layout of widget before calling setWidget() or won't
// be visible.
objScroll->setWidget(scrollChild);
objDetail->setLayout(objGroupLayout);
}