QtProfileWindow::QtProfileWindow() { setWindowTitle(tr("Edit Profile")); QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum); sizePolicy.setHorizontalStretch(0); sizePolicy.setVerticalStretch(0); sizePolicy.setHeightForWidth(this->sizePolicy().hasHeightForWidth()); setSizePolicy(sizePolicy); QVBoxLayout* layout = new QVBoxLayout(this); layout->setContentsMargins(10, 10, 10, 10); QHBoxLayout* topLayout = new QHBoxLayout(); avatar = new QtAvatarWidget(this); topLayout->addWidget(avatar); QVBoxLayout* fieldsLayout = new QVBoxLayout(); QHBoxLayout* horizontalLayout_2 = new QHBoxLayout(); nicknameLabel = new QLabel(tr("Nickname:"), this); horizontalLayout_2->addWidget(nicknameLabel); nickname = new QLineEdit(this); horizontalLayout_2->addWidget(nickname); fieldsLayout->addLayout(horizontalLayout_2); errorLabel = new QLabel(this); errorLabel->setAlignment(Qt::AlignHCenter); fieldsLayout->addWidget(errorLabel); fieldsLayout->addItem(new QSpacerItem(198, 17, QSizePolicy::Minimum, QSizePolicy::Expanding)); topLayout->addLayout(fieldsLayout); layout->addLayout(topLayout); QHBoxLayout* horizontalLayout = new QHBoxLayout(); horizontalLayout->setContentsMargins(0, 0, 0, 0); horizontalLayout->addItem(new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum)); throbberLabel = new QLabel(this); throbberLabel->setMovie(new QMovie(":/icons/throbber.gif", QByteArray(), this)); horizontalLayout->addWidget(throbberLabel); saveButton = new QPushButton(tr("Save"), this); saveButton->setDefault( true ); connect(saveButton, SIGNAL(clicked()), SLOT(handleSave())); horizontalLayout->addWidget(saveButton); fieldsLayout->addLayout(horizontalLayout); resize(360, 120); }
static int handleWMCommand(HWND hDlg, LPARAM lParam, WPARAM wParam) { switch (LOWORD(wParam)) { case DD_J1: type = 1; tool=joint; hCurrentPen = drawPen[1]; break; case DD_J2: type = 2; tool=joint; hCurrentPen = drawPen[2]; break; case DD_J3: type = 3; tool=joint; hCurrentPen = drawPen[3]; break; case DD_J4: type = 4; tool=joint; hCurrentPen = drawPen[4]; break; case DD_J5: type = 5; tool=joint; hCurrentPen = drawPen[5]; break; case DD_J6: type = 6; tool=joint; hCurrentPen = drawPen[6]; break; case DD_J7: type = 7; tool=joint; hCurrentPen = drawPen[7]; break; case DD_J8: type = 8; tool=joint; hCurrentPen = drawPen[8]; break; case DD_FP: type = 0; tool=fixedpoint; hCurrentPen = drawPen[1]; break; case DD_MP: type = 1; tool=measpoint; hCurrentPen = drawPen[1]; break; case DD_LP: type = 2; tool=loadpoint; hCurrentPen = drawPen[1]; break; case DD_HP: type = 3; tool=holepoint; hCurrentPen = drawPen[1]; break; case DD_BOLT1: handleRockbolts(hDlg); break; case DD_GRON: handleGridOn(hdc,jp,nLines,pp,nPoints); break; case DD_GROFF: handleGridOff(hdc,jp,nLines,pp,nPoints); break; case DD_REMJ: handleRemoveJoints(hDlg,hdc,jp); break; case DD_REMP: handleRemovePoints(hDlg,hdc,pp); break; /* Handles changing grid spacing? * TODO: Collapse this into a single callable function. */ case IDC_GRID: if (grid) { handleGridOff(hdc,jp,nLines,pp,nPoints); grid=TRUE; } gridSp=changeGridSpacing(hDlg,lParam,wParam); if (grid) { handleGridOn(hdc,jp,nLines,pp,nPoints); } break; case IDCANCEL: handleCancel(hDlg); return FALSE; case IDOK: return(handleSave(hDlg)); } /* end switch wParam */ } /* close handleWMCommand() */
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow), curPage(0), curQuestion(0), zoomFactor(1.0) { /* Set up the Qt user interface */ ui->setupUi(this); Global::setMainWindow(this); /* Set up a status bar in the main window */ QStatusBar *sb = statusBar(); QLabel *statusLabel = new QLabel (""); sb->addWidget(statusLabel); Global::setStatusLabel(statusLabel); /* Set up the GradeWindow and also fill the table with initial values from the database */ Global::setGradeWindow(new GradeWindow); /* Set up page change buttons */ connect(ui->pageLeft , SIGNAL(clicked()), this, SLOT(handlePagePrev())); connect(ui->pageRight, SIGNAL(clicked()), this, SLOT(handlePageNext())); connect(ui->studentPrev, SIGNAL(clicked()), this, SLOT(handleStudentPrev())); connect(ui->studentNext, SIGNAL(clicked()), this, SLOT(handleStudentNext())); connect(ui->questionPrev, SIGNAL(clicked()), this, SLOT(handleQuestionPrev())); connect(ui->questionNext, SIGNAL(clicked()), this, SLOT(handleQuestionNext())); connect(ui->zoomIn, SIGNAL(clicked()), this, SLOT(handleZoomIn())); connect(ui->zoomOut, SIGNAL(clicked()), this, SLOT(handleZoomOut())); connect(ui->zoomWidth, SIGNAL(clicked()), this, SLOT(handleZoomWidth())); connect(ui->zoomHeight, SIGNAL(clicked()), this, SLOT(handleZoomHeight())); connect(ui->zoomOne, SIGNAL(clicked()), this, SLOT(handleZoomOne())); /* Set up various actions */ connect(ui->actionSave, SIGNAL(triggered()), this, SLOT(handleSave())); connect(ui->actionGenPDFs, SIGNAL(triggered()), this, SLOT(handleGeneratePDFs())); connect(Global::gw()->getUI()->actionSave, SIGNAL(triggered()), this, SLOT(handleSave())); connect(ui->actionPagePrev, SIGNAL(triggered()), this, SLOT(handlePagePrev())); connect(ui->actionPageNext, SIGNAL(triggered()), this, SLOT(handlePageNext())); connect(ui->actionStudentPrev, SIGNAL(triggered()), this, SLOT(handleStudentPrev())); connect(ui->actionStudentNext, SIGNAL(triggered()), this, SLOT(handleStudentNext())); connect(ui->actionGradeWindow, SIGNAL(triggered()), Global::gw(), SLOT(handleGradeWindow())); connect(Global::gw()->getUI()->actionGradeWindow, SIGNAL(triggered()), Global::gw(), SLOT(handleGradeWindow())); connect(ui->actionResizeContents, SIGNAL(triggered()), Global::gw(), SLOT(handleResizeContents())); connect(ui->actionResizeLarge, SIGNAL(triggered()), Global::gw(), SLOT(handleResizeLarge())); connect(ui->actionResizeSmall, SIGNAL(triggered()), Global::gw(), SLOT(handleResizeSmall())); /* Detect user input in data entry fields */ connect(ui->studentId, SIGNAL(textEdited(const QString&)), this, SLOT(handleEditStudentId(const QString&))); connect(ui->studentName, SIGNAL(textEdited(const QString&)), this, SLOT(handleEditStudentName(const QString&))); connect(ui->questionScore, SIGNAL(textEdited(const QString&)), this, SLOT(handleEditQuestionScore(const QString&))); connect(ui->questionFeedback, SIGNAL(textEdited(const QString&)), this, SLOT(handleEditQuestionFeedback(const QString&))); connect(ui->questionMaximum, SIGNAL(textEdited(const QString&)), this, SLOT(handleEditQuestionMaximum(const QString&))); connect(ui->questionPage, SIGNAL(textEdited(const QString&)), this, SLOT(handleEditQuestionPage(const QString&))); connect(ui->action0_Points, SIGNAL(triggered()), this, SLOT(handleScore0())); connect(ui->action1_Point, SIGNAL(triggered()), this, SLOT(handleScore1())); connect(ui->action2_Points, SIGNAL(triggered()), this, SLOT(handleScore2())); connect(ui->action3_Points, SIGNAL(triggered()), this, SLOT(handleScore3())); connect(ui->action4_Points, SIGNAL(triggered()), this, SLOT(handleScore4())); connect(ui->action5_Points, SIGNAL(triggered()), this, SLOT(handleScore5())); connect(ui->action6_Points, SIGNAL(triggered()), this, SLOT(handleScore6())); connect(ui->action7_Points, SIGNAL(triggered()), this, SLOT(handleScore7())); connect(ui->action8_Points, SIGNAL(triggered()), this, SLOT(handleScore8())); connect(ui->actionEmpty_Points, SIGNAL(triggered()), this, SLOT(handleScoreEmpty())); /* Now set the first page and first question */ adjustPage(0); adjustQuestion(0); }