MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { label = new QLabel("0", this); label -> setGeometry(QRect(QPoint(50,70),QSize(250,50))); label->setStyleSheet("background-color: rgb(221,160,221); font: bold 14px;"); label->setAlignment(Qt::AlignCenter); for(int i =0; i<10; i++){ QString operations[] = {"C","=","+","-","*","/","^","root","sqrt","+-"}; operationButton[i] = new QPushButton(operations[i],this); if(i == 1){ connect(operationButton[i],SIGNAL(released()),this, SLOT(equals())); } else if(i == 9){ connect(operationButton[i],SIGNAL(released()),this, SLOT(signf())); } else{ connect(operationButton[i],SIGNAL(released()),this, SLOT(operationPushed())); } } for(int i =0; i<10; i++){ QString digit = QString::number(i); buttons[i] = new QPushButton(digit,this); connect(buttons[i],SIGNAL(released()),this, SLOT(buttonPushed())); } setGeo(); }
/*! This constructor creates an iterator for the given node. It is useful to create an iterator to be used to seek() to a specific indexed edge. Otherwise, use Geometry::beginEdges() resp. Geometry::endEdges() to create an iterator. */ EdgeIterator::EdgeIterator(Node * const geo) : PrimitiveIterator(), _edgeIndex(0), _actPrimIndex() { _edgePntIndex[0] = 0; _edgePntIndex[1] = 0; setGeo(geo); }
/*! This constructor creates an iterator for the given geometry. It is useful to create an iterator to be used to seek() to a specific indexed edge. Otherwise, use Geometry::beginEdges() resp. Geometry::endEdges() to create an iterator. */ EdgeIterator::EdgeIterator(Geometry const * geo) : PrimitiveIterator(), _edgeIndex(0), _actPrimIndex() { _edgePntIndex[0] = 0; _edgePntIndex[1] = 0; setGeo(geo); }
/*! This constructor creates an iterator for the given node. It is useful to create an iterator to be used to seek() to a specific indexed face. Otherwise, use Geometry::beginFaces() resp. Geometry::endFaces() to create an iterator. */ FaceIterator::FaceIterator(Node * const geo) : PrimitiveIterator(), _faceIndex(0), _actPrimIndex() { _facePntIndex[0] = 0; _facePntIndex[1] = 0; _facePntIndex[2] = 0; _facePntIndex[3] = 0; setGeo(geo); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { title = new QLabel("Calculator",this); title -> setGeometry(QRect(QPoint(100,25),QSize(200,50))); label = new QLabel("0",this); label -> setGeometry(QRect(QPoint(50,50),QSize(200,50))); QString inStr = "Input Path"; inputPath = new QLineEdit(inStr,this); inputPath -> setGeometry(QRect(QPoint(25,375),QSize(250,50))); inputPath -> hide(); QString outStr = "Output Path"; outputPath = new QLineEdit(outStr,this); outputPath -> setGeometry(QRect(QPoint(25,450),QSize(250,50))); outputPath -> hide(); submitButton = new QPushButton("Submit",this); connect(submitButton,SIGNAL(released()),this,SLOT(submitPath())); submitButton -> setGeometry(QRect(QPoint(100,525),QSize(100,50))); submitButton -> hide(); filePath = new QPushButton("Open",this); connect(filePath,SIGNAL(released()),this,SLOT(fileOpeAppear())); hideFilePath = new QPushButton("Close",this); connect(hideFilePath,SIGNAL(released()),this,SLOT(fileOpeDisappear())); backspace = new QPushButton("backspace",this); connect(backspace,SIGNAL(released()),this,SLOT(BackSpace())); operationButton[0] = new QPushButton("=",this); connect(operationButton[0],SIGNAL(released()),this,SLOT(equals())); operationButton[1] = new QPushButton("Esc",this); connect(operationButton[1],SIGNAL(released()),this,SLOT(clear())); for (int i = 2; i<10; i++) { QString operations[] = {"=","ESC","+","-","×","÷","(",")",".","^"}; operationButton[i] = new QPushButton(operations[i],this); connect(operationButton[i],SIGNAL(released()),this,SLOT(operationPushed())); } for (int i = 0; i<10; i++) { QString digit = QString::number(i); buttons[i] = new QPushButton(digit,this); connect(buttons[i],SIGNAL(released()),this,SLOT(buttonPushed())); } setGeo(); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { label = new QLabel("0", this); label->setGeometry(QRect(QPoint(4 * cell_size, cell_size), QSize(4 * cell_size, cell_size))); for (size_t i = 0; i < sizeof(operations)/sizeof(QPushButton *); i++) { QString oper[] = {"C", "=", "+", "-", "*", "/"}; operations[i] = new QPushButton(oper[i], this); if (oper[i] == "="){ connect(operations[i], SIGNAL(released()), this, SLOT(equals())); }else{ connect(operations[i], SIGNAL(released()), this, SLOT(operationPushed())); } } for (size_t i = 0; i < sizeof(buttons)/sizeof(QPushButton *); i++) { QString digit = QString::number(i); buttons[i] = new QPushButton(digit, this); connect(buttons[i], SIGNAL(released()), this, SLOT(buttonPushed())); } setGeo(); }
void QSplitterPrivate::doResize() { Q_Q(QSplitter); QRect r = q->contentsRect(); int n = list.count(); QVector<QLayoutStruct> a(n*2); int i; bool noStretchFactorsSet = true; for (i = 0; i < n; ++i) { QSizePolicy p = list.at(i)->widget->sizePolicy(); int sf = orient == Qt::Horizontal ? p.horizontalStretch() : p.verticalStretch(); if (sf != 0) { noStretchFactorsSet = false; break; } } int j=0; for (i = 0; i < n; ++i) { QSplitterLayoutStruct *s = list.at(i); #ifdef QSPLITTER_DEBUG qDebug("widget %d hidden: %d collapsed: %d handle hidden: %d", i, s->widget->isHidden(), s->collapsed, s->handle->isHidden()); #endif a[j].init(); if (s->handle->isHidden()) { a[j].maximumSize = 0; } else { a[j].sizeHint = a[j].minimumSize = a[j].maximumSize = s->getHandleSize(orient); a[j].empty = false; } ++j; a[j].init(); if (s->widget->isHidden() || s->collapsed) { a[j].maximumSize = 0; } else { a[j].minimumSize = pick(qSmartMinSize(s->widget)); a[j].maximumSize = pick(s->widget->maximumSize()); a[j].empty = false; bool stretch = noStretchFactorsSet; if (!stretch) { QSizePolicy p = s->widget->sizePolicy(); int sf = orient == Qt::Horizontal ? p.horizontalStretch() : p.verticalStretch(); stretch = (sf != 0); } if (stretch) { a[j].stretch = s->getWidgetSize(orient); a[j].sizeHint = a[j].minimumSize; a[j].expansive = true; } else { a[j].sizeHint = qMax(s->getWidgetSize(orient), a[j].minimumSize); } } ++j; } qGeomCalc(a, 0, n*2, pick(r.topLeft()), pick(r.size()), 0); #ifdef QSPLITTER_DEBUG for (i = 0; i < n*2; ++i) { qDebug("%*s%d: stretch %d, sh %d, minS %d, maxS %d, exp %d, emp %d -> %d, %d", i, "", i, a[i].stretch, a[i].sizeHint, a[i].minimumSize, a[i].maximumSize, a[i].expansive, a[i].empty, a[i].pos, a[i].size); } #endif for (i = 0; i < n; ++i) { QSplitterLayoutStruct *s = list.at(i); setGeo(s, a[i*2+1].pos, a[i*2+1].size, false); } }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { label = new QLabel("0", this); label -> setGeometry(QRect(QPoint(75,25),QSize(50,200))); clear_button = new QPushButton("C", this); clear_button -> setGeometry(QRect(QPoint(100,300),QSize(50,50))); connect(clear_button, SIGNAL(released()), this,SLOT(clear())); equals_button = new QPushButton("=", this); equals_button -> setGeometry(QRect(QPoint(150,300),QSize(50,50))); connect(equals_button, SIGNAL(released()), this,SLOT(equals())); add_button = new QPushButton("+", this); add_button -> setGeometry(QRect(QPoint(200,150),QSize(50,50))); connect(add_button, SIGNAL(released()), this,SLOT(add())); subtract_button = new QPushButton("-", this); subtract_button -> setGeometry(QRect(QPoint(200,200),QSize(50,50))); connect(subtract_button, SIGNAL(released()), this,SLOT(subtract())); multiply_button = new QPushButton("X", this); multiply_button -> setGeometry(QRect(QPoint(200,250),QSize(50,50))); connect(multiply_button, SIGNAL(released()), this,SLOT(multiply())); divide_button = new QPushButton(":", this); divide_button -> setGeometry(QRect(QPoint(200,300),QSize(50,50))); connect(divide_button, SIGNAL(released()), this,SLOT(divide())); sin_button = new QPushButton("sin", this); sin_button -> setGeometry(QRect(QPoint(250,150),QSize(50,50))); connect(sin_button, SIGNAL(released()), this,SLOT(sin())); cos_button = new QPushButton("cos", this); cos_button -> setGeometry(QRect(QPoint(250,200),QSize(50,50))); connect(cos_button, SIGNAL(released()), this,SLOT(cos())); tan_button = new QPushButton("tan", this); tan_button -> setGeometry(QRect(QPoint(250,250),QSize(50,50))); connect(tan_button, SIGNAL(released()), this,SLOT(tan())); sqrt_button = new QPushButton("sqrt", this); sqrt_button -> setGeometry(QRect(QPoint(250,300),QSize(50,50))); connect(sqrt_button, SIGNAL(released()), this,SLOT( sqrt())); pow_button = new QPushButton("^2", this); pow_button -> setGeometry(QRect(QPoint(250,350),QSize(50,50))); connect(pow_button, SIGNAL(released()), this,SLOT(pow())); cubic_button = new QPushButton("^3", this); cubic_button -> setGeometry(QRect(QPoint(200,350),QSize(50,50))); connect(cubic_button, SIGNAL(released()), this,SLOT(cubic())); exp_button = new QPushButton("exp", this); exp_button -> setGeometry(QRect(QPoint(150,350),QSize(50,50))); connect(exp_button, SIGNAL(released()), this,SLOT(exp())); ln_button = new QPushButton("ln", this); ln_button -> setGeometry(QRect(QPoint(100,350),QSize(50,50))); connect(ln_button, SIGNAL(released()), this,SLOT(ln())); for(int i=0; i<10; i++){ QString digit = QString::number(i); buttons[i] = new QPushButton(digit, this); connect(buttons[i], SIGNAL(released()), this,SLOT(buttonPushed())); } setGeo(); }