LevelWidget::LevelWidget(QWidget *parent, int mode) : QWidget(parent) { ui.setupUi(this); ui.addPushButton->setDefault(true); QFont font = QFont("SimSun", 9); settingFont(font); int col = 0; m_mode = mode; if(0 == mode) { ui.submitPushButton->setDisabled(true); } m_DataModel = new QStandardItemModel(0, 4, this); ui.levelTableView->setModel(m_DataModel); ui.levelTableView->setAlternatingRowColors(true); ui.levelTableView->hideColumn(0); ui.levelTableView->setSelectionBehavior(QAbstractItemView::SelectRows); m_DataModel->setHeaderData(col, Qt::Horizontal, QString::fromLocal8Bit("编号")); ui.levelTableView->setColumnWidth(col++, 40); m_DataModel->setHeaderData(col, Qt::Horizontal, QString::fromLocal8Bit("等级")); ui.levelTableView->setColumnWidth(col++, 60); m_DataModel->setHeaderData(col, Qt::Horizontal, QString::fromLocal8Bit("提成(%)")); ui.levelTableView->setColumnWidth(col++, 65); m_DataModel->setHeaderData(col++, Qt::Horizontal, QString::fromLocal8Bit("备注")); connect(ui.addPushButton, SIGNAL(clicked()), this, SLOT(add())); connect(ui.removePushButton, SIGNAL(clicked()), this, SLOT(remove())); connect(ui.submitPushButton, SIGNAL(clicked()), this, SLOT(submit())); }
ViewPlot::ViewPlot(QWidget *parent) : QMainWindow(parent), ui(new Ui::ViewPlot) { ui->setupUi(this); this->setWindowFlags( Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint | Qt::WindowSystemMenuHint | Qt::WindowMaximizeButtonHint | Qt::WindowMinimizeButtonHint); ui->centralwidget->setStyleSheet("background-color: white;"); stngViewPlot = new QSettings((QCoreApplication::applicationDirPath()) + "//configSanPasport.ini",QSettings::IniFormat); // Строка состояния sb1 = new QLabel(statusBar()); ui->statusbar->setSizeGripEnabled(false); ui->statusbar->addWidget(sb1, 1); sb1->setText(""); connect( ui->action_Open, SIGNAL(triggered()), SLOT(plotOpen()) ); connect( ui->action_FileExport, SIGNAL(triggered()), SLOT(plotExport()) ); connect( ui->action_CopyToBuffer, SIGNAL(triggered()), SLOT(copyToBuffer()) ); connect( ui->action_Exit, SIGNAL(triggered()), SLOT(close()) ); connect( ui->action_ConfizGraph, SIGNAL(triggered()), SLOT(showConfizGraph()) ); connect( ui->action_Font, SIGNAL(triggered()), SLOT(settingFont()) ); connect( ui->frame, SIGNAL(sgnlRazmer()), SLOT(plotSquare()) ); // Подписи к осям ui->qwtPlot_spectrogram->axisScaleDraw(QwtPlot::xTop)->enableComponent(QwtScaleDraw::Labels, false); ui->qwtPlot_spectrogram->axisScaleDraw(QwtPlot::yRight)->enableComponent(QwtScaleDraw::Labels, false); ui->qwtPlot_spectrogram->setAxisEnableForAll(true); // Позиция курсора picker = new PlotZozPicker( ui->qwtPlot_spectrogram->canvas() ); connect( picker, SIGNAL(position(QString)), SLOT(plotPos(QString)) ); connect( ui->qwtPlot_spectrogram, SIGNAL(sgnlOutCanvas()), SLOT(plotPosReset()) ); plotPosReset(); // Кривая для легенды curve = new QwtPlotCurve(); curve->setPen( Qt::red, 2 ); curve->setLegendAttribute( QwtPlotCurve::LegendShowLine, true ); curve->setLegendIconSize(QSize(30,2)); curve->attach(ui->qwtPlot_spectrogram); // Легенда qwtLeg = new QwtLegend(); qwtLeg->contentsWidget()->layout()->setAlignment(Qt::AlignLeft | Qt::AlignVCenter); ui->qwtPlot_spectrogram->insertLegend( qwtLeg, QwtPlot::RightLegend); // Маркеры markerV = new PlotZozMarker(QwtPlotMarker::VLine); markerH = new PlotZozMarker(QwtPlotMarker::HLine); // Костыль - чтоб не мигал ратянутый график QGraphicsOpacityEffect *effect = new QGraphicsOpacityEffect; effect->setOpacity(0); ui->frame->setGraphicsEffect(effect); // Контекстное меню ui->frame->setContextMenuPolicy(Qt::CustomContextMenu); connect( ui->frame, SIGNAL(customContextMenuRequested(QPoint)), SLOT(contextMenuView(QPoint)) ); }