void AccessibilityInspector::inspectWindow(QWindow *window)
{
    qDebug() << "AccessibilityInspector::inspectWindow()" << window;
    if (window->parent() || window->transientParent())
        return;

    optionsWidget = new OptionsWidget();

    accessibilityScene = new MouseInterceptingGraphicsScene();

    accessibilityView = new QGraphicsView();
    accessibilityView->setScene(accessibilityScene);
    accessibilityView->resize(640, 480);
    accessibilityView->scale(1.3, 1.3);

    accessibilityTreeScene = new QGraphicsScene();

    accessibilityTreeView = new QGraphicsView();
    accessibilityTreeView->setScene(accessibilityTreeScene);
    accessibilityTreeView->resize(640, 480);

    sceneManager = new AccessibilitySceneManager();
    QObject::connect(optionsWidget, SIGNAL(optionsChanged()), sceneManager, SLOT(updateAccessibilitySceneItemFlags()));
    QObject::connect(optionsWidget, SIGNAL(refreshClicked()), sceneManager, SLOT(populateAccessibilityScene()));
    QObject::connect(optionsWidget, SIGNAL(refreshClicked()), sceneManager, SLOT(populateAccessibilityTreeScene()));
    QObject::connect(optionsWidget, SIGNAL(scaleChanged(int)), sceneManager, SLOT(changeScale(int)));

    sceneManager->setOptionsWidget(optionsWidget);
    sceneManager->setRootWindow(window);
    sceneManager->setScene(accessibilityScene);
    sceneManager->setView(accessibilityView);
    sceneManager->setTreeScene(accessibilityTreeScene);
    sceneManager->setTreeView(accessibilityTreeView);

    screenReader = new ScreenReader;
    QObject::connect(accessibilityScene, SIGNAL(mousePressed(QPoint)), screenReader, SLOT(touchPoint(QPoint)));
    QObject::connect(accessibilityScene, SIGNAL(mouseDobleClicked()), screenReader, SLOT(activate()));
    QObject::connect(screenReader, SIGNAL(selected(QObject*)), sceneManager, SLOT(setSelected(QObject*)));
    screenReader->setRootObject(window);
    screenReader->setOptionsWidget(optionsWidget);

    previousUpdateHandler = QAccessible::installUpdateHandler(accessibilityUpdateHandler);

    QTimer::singleShot(100, sceneManager, SLOT(populateAccessibilityScene()));
    QTimer::singleShot(100, sceneManager, SLOT(populateAccessibilityTreeScene()));

    QSettings settings;
    accessibilityView->restoreGeometry(settings.value("accessiblityGeometry").toByteArray());
    accessibilityView->setObjectName(QLatin1String("accessibilityInspectorView"));
    accessibilityView->show();


    accessibilityTreeView->restoreGeometry(settings.value("treeGeometry").toByteArray());
    accessibilityTreeView->setObjectName(QLatin1String("accessibilityInspectorTreeView"));
    accessibilityTreeView->show();
    optionsWidget->restoreGeometry(settings.value("optionsGeometry").toByteArray());
    optionsWidget->setObjectName(QLatin1String("accessibilityInspectorOptions"));
    optionsWidget->show();
}
Exemplo n.º 2
0
void VPlotOps::newSelection(VPlot * selPlot, bool forceConnect) {
  if (selPlot != m_selPlot || forceConnect) {
    if (!m_firstTime) {
      m_selPlot->setFrameStyle(0);
      disconnect(b_logx, SIGNAL(stateChanged(int)), m_selPlot->m_vcp, SLOT(doLogX(int)));
      disconnect(b_logy, SIGNAL(stateChanged(int)), m_selPlot->m_vcp, SLOT(doLogY(int)));
      disconnect(b_logz, SIGNAL(stateChanged(int)), m_selPlot->m_vcp, SLOT(doLogZ(int)));
      if (m_selPlot->m_multipleModules) {
          disconnect(b_moduleSelector1, SIGNAL(currentIndexChanged(int)), m_selPlot, SLOT(moduleChanged()));
          disconnect(b_moduleSelector2, SIGNAL(currentIndexChanged(int)), m_selPlot, SLOT(moduleChanged()));
          m_moduleSelector->setEnabled(false);
      }

      disconnect(b_popout, SIGNAL(clicked()), m_selPlot->m_vcp, SLOT(popoutClicked()));
      disconnect(b_ref, SIGNAL(clicked()), m_selPlot->m_vcp, SLOT(refreshClicked()));
      delete m_statsBox;
    }

    m_firstTime = false;
    if (selPlot->m_vcp->m_xLogged) b_logx->setChecked(true);
    else b_logx->setChecked(false);
    if (selPlot->m_vcp->m_yLogged) b_logy->setChecked(true);
    else b_logy->setChecked(false);
    if (selPlot->m_vcp->m_zLogged) b_logz->setChecked(true);
    else b_logz->setChecked(false);



    m_selPlot = selPlot;
    m_selPlot->setFrameStyle(3);

    connect(b_logx, SIGNAL(stateChanged(int)), selPlot->m_vcp, SLOT(doLogX(int)));
    connect(b_logy, SIGNAL(stateChanged(int)), selPlot->m_vcp, SLOT(doLogY(int)));
    connect(b_logz, SIGNAL(stateChanged(int)), selPlot->m_vcp, SLOT(doLogZ(int)));
    connect(b_popout, SIGNAL(clicked()), selPlot->m_vcp, SLOT(popoutClicked()));
    connect(b_ref, SIGNAL(clicked()), selPlot->m_vcp, SLOT(refreshClicked()));
    if (m_selPlot->m_multipleModules) {
      m_moduleSelector->setEnabled(true);
      connect(b_moduleSelector1, SIGNAL(currentIndexChanged(int)), m_selPlot, SLOT(moduleChanged()));
      connect(b_moduleSelector2, SIGNAL(currentIndexChanged(int)), m_selPlot, SLOT(moduleChanged()));
    }

    std::cout<<"Selection made"<<std::endl;


    m_statsBox = selPlot->exportStatsBox();
    m_layout->addWidget(m_statsBox, m_layout->rowCount(), 0, 1, m_layout->columnCount());
  }
Exemplo n.º 3
0
SeExprEdAnimCurveControl::SeExprEdAnimCurveControl(int id,SeExprEdAnimCurveEditable* editable)
:SeExprEdControl(id,editable,false),_editable(editable)
{

    _preview=new SeExprEdGraphPreview();
    _preview->setMinimumWidth(200);
    _preview->setMinimumHeight(60);
    hbox->addWidget(_preview);
    //QPushButton* button=new QPushButton();
    //button->setIcon(QIcon(QPixmap(graphXPM)));
    Q_UNUSED(graphXPM)
    QPushButton* refreshButton=new QPushButton();
    refreshButton->setMaximumWidth(30);
    refreshButton->setIcon(QIcon(QPixmap(refreshXPM)));
    QPushButton* expandButton=new QPushButton(">");
    expandButton->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Expanding);
    expandButton->setFixedWidth(15);
    hbox->addWidget(expandButton);
    //hbox->addWidget(button);
    refreshButton->setVisible(_editable->link!="");
    hbox->addWidget(refreshButton);

#ifdef SEEXPR_USE_ANIMLIB
    _preview->sample(editable->curve);
#endif
    connect(expandButton,SIGNAL(clicked()),this,SLOT(editGraphClicked()));
    //connect(_preview,SIGNAL(clicked()),this,SLOT(editGraphClicked()));
    connect(refreshButton,SIGNAL(clicked()),this,SLOT(refreshClicked()));
}
Exemplo n.º 4
0
MarketData::MarketData(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::MarketData)
{
    ui->setupUi(this);
    connect(&networkAccessManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(parseNetworkResponse(QNetworkReply*)));
    connect(ui->refreshButton, SIGNAL(pressed()), this, SLOT(refreshClicked()));
}
Exemplo n.º 5
0
void KMJobViewer::triggerRefresh()
{
    // parent widget -> embedded in KControl and needs
    // to update itself. Otherwise, it's standalone
    // kjobviewer and we need to synchronize all possible
    // opened windows -> do the job on higher level.
    if (!m_standalone)
        refresh(true);
    else
        emit refreshClicked();
}
Exemplo n.º 6
0
void MiningDialog::setModel(ClientModel *model)
{
    if(model)
    {
     
		   connect(ui->btnRefresh, SIGNAL(clicked()), this, SLOT(refreshClicked()));
		   connect(ui->btnExit, SIGNAL(clicked()), this, SLOT(exitClicked()));
		   connect(ui->btnRegister, SIGNAL(clicked()), this, SLOT(registerClicked()));
		   connect(ui->btnUnregister, SIGNAL(clicked()), this, SLOT(unregisterClicked()));
		   MiningDialog::refreshClicked();

    }
}
Exemplo n.º 7
0
void WifiTitleItem::onItemActivated(CatalogView *catalog, ContentView *item, int user_data)
{
    if (!item || !item->data())
    {
        return;
    }

    int id = item->data()->value(TAG_ID).toInt();
    if (id == ID_CUSTOMIZE)
    {
        emit customizedClicked();
    }
    else if (id == ID_REFRESH)
    {
        emit refreshClicked();
    }
}
int NetcardsPanel::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0:
            currentNetcardChanged((*reinterpret_cast< int(*)>(_a[1])));
            break;
        case 1:
            refreshClicked();
            break;
        case 2:
            requestGoPLCPage((*reinterpret_cast< bool(*)>(_a[1])));
            break;
        case 3:
            backClicked();
            break;
        case 4:
            onNetcardsChanged((*reinterpret_cast< const SVT_NotifyType(*)>(_a[1])));
            break;
        case 5:
            slot_RefreshCurrentSetting();
            break;
        case 6:
            setPLCBtnUsible((*reinterpret_cast< bool(*)>(_a[1])));
            break;
        case 7:
            setBackBtnUsible((*reinterpret_cast< bool(*)>(_a[1])));
            break;
        case 8:
            setBackBtnText((*reinterpret_cast< const QString(*)>(_a[1])));
            break;
        case 9:
            buttonClicked((*reinterpret_cast< int(*)>(_a[1])));
            break;
        default:
            ;
        }
        _id -= 10;
    }
    return _id;
}
Exemplo n.º 9
0
ScriptCollectionHeader::ScriptCollectionHeader( QWidget* parent )
    : FilterHeader( parent )
{
    m_refreshButton = new QPushButton( this );
    m_refreshButton->setFlat( true );
    m_refreshButton->setStyleSheet( "QPushButton { border: 0px; background: transparent; }" );
    QHBoxLayout* descLayout = new QHBoxLayout;
    ui->horizontalLayout->addLayout( descLayout );
//    descLayout->addWidget( m_descriptionLabel );
    TomahawkUtils::unmarginLayout( descLayout );
//    descLayout->addSpacing( m_descriptionLabel->fontMetrics().height() / 2 );
    descLayout->addWidget( m_refreshButton );
    descLayout->addStretch();

    m_refreshButton->setIcon( ImageRegistry::instance()->pixmap( RESPATH "images/refresh.svg", QSize( ui->captionLabel->fontMetrics().height(),
                              ui->captionLabel->fontMetrics().height() ), TomahawkUtils::DropShadow ) );
    m_refreshButton->setFixedSize( ui->captionLabel->fontMetrics().height() + ui->captionLabel->margin() * 2,
                                   ui->captionLabel->fontMetrics().height() + ui->captionLabel->margin() * 2 );

    connect( m_refreshButton, SIGNAL( clicked() ), SIGNAL( refreshClicked() ) );
    m_refreshButton->hide();
    m_refreshButton->setToolTip( tr( "Reload Collection" ) );
}
Exemplo n.º 10
0
WindowLayerDialog::WindowLayerDialog(WindowLayer *layer, QWidget *parent)
	: LayerDialog(layer, parent)
	, m_ui()
	, m_windows()
	, m_ignoreSignals(false)
{
	m_ui.setupUi(this);
	m_windows.reserve(16);

	// Setup custom widgets
	m_ui.leftCropEdit->setUnits(tr("px"));
	m_ui.rightCropEdit->setUnits(tr("px"));
	m_ui.topCropEdit->setUnits(tr("px"));
	m_ui.botCropEdit->setUnits(tr("px"));

	// Populate window select combo box
	refreshClicked();

	//-------------------------------------------------------------------------
	// Capture tab

	// Connect button signals
	connect(m_ui.refreshBtn, &QPushButton::clicked,
		this, &WindowLayerDialog::refreshClicked);
	connect(m_ui.addBtn, &QPushButton::clicked,
		this, &WindowLayerDialog::addWindowClicked);
	connect(m_ui.removeBtn, &QPushButton::clicked,
		this, &WindowLayerDialog::removeWindowClicked);
	connect(m_ui.moveUpBtn, &QPushButton::clicked,
		this, &WindowLayerDialog::moveUpClicked);
	connect(m_ui.moveDownBtn, &QPushButton::clicked,
		this, &WindowLayerDialog::moveDownClicked);

	// Notify the dialog when settings change
	connect(m_ui.showCursorBtn, &QPushButton::clicked,
		this, &LayerDialog::settingModified);
	connect(m_ui.hideCursorBtn, &QPushButton::clicked,
		this, &LayerDialog::settingModified);

	//-------------------------------------------------------------------------
	// Cropping tab

	// Setup validators
	m_ui.leftCropEdit->setValidator(new QIntValidator(0, INT_MAX, this));
	m_ui.rightCropEdit->setValidator(new QIntValidator(0, INT_MAX, this));
	m_ui.topCropEdit->setValidator(new QIntValidator(0, INT_MAX, this));
	m_ui.botCropEdit->setValidator(new QIntValidator(0, INT_MAX, this));
	connect(m_ui.leftCropEdit, &QLineEdit::textChanged,
		this, &WindowLayerDialog::leftCropEditChanged);
	connect(m_ui.rightCropEdit, &QLineEdit::textChanged,
		this, &WindowLayerDialog::rightCropEditChanged);
	connect(m_ui.topCropEdit, &QLineEdit::textChanged,
		this, &WindowLayerDialog::topCropEditChanged);
	connect(m_ui.botCropEdit, &QLineEdit::textChanged,
		this, &WindowLayerDialog::botCropEditChanged);

	// Notify the dialog when settings change
	connect(m_ui.leftCropEdit, &QLineEdit::textChanged,
		this, &LayerDialog::settingModified);
	connect(m_ui.rightCropEdit, &QLineEdit::textChanged,
		this, &LayerDialog::settingModified);
	connect(m_ui.topCropEdit, &QLineEdit::textChanged,
		this, &LayerDialog::settingModified);
	connect(m_ui.botCropEdit, &QLineEdit::textChanged,
		this, &LayerDialog::settingModified);

	//-------------------------------------------------------------------------
	// Colour adjustment tab

	// Connect widget signals
	void (QSpinBox:: *fpiSB)(int) = &QSpinBox::valueChanged;
	void (QDoubleSpinBox:: *fpiDSB)(double) = &QDoubleSpinBox::valueChanged;
	connect(m_ui.gammaSlider, &QAbstractSlider::valueChanged,
		this, &WindowLayerDialog::gammaSliderChanged);
	connect(m_ui.gammaBox, fpiDSB,
		this, &WindowLayerDialog::gammaBoxChanged);
	connect(m_ui.brightnessSlider, &QAbstractSlider::valueChanged,
		this, &WindowLayerDialog::brightnessChanged);
	connect(m_ui.brightnessBox, fpiSB,
		this, &WindowLayerDialog::brightnessChanged);
	connect(m_ui.contrastSlider, &QAbstractSlider::valueChanged,
		this, &WindowLayerDialog::contrastChanged);
	connect(m_ui.contrastBox, fpiSB,
		this, &WindowLayerDialog::contrastChanged);
	connect(m_ui.saturationSlider, &QAbstractSlider::valueChanged,
		this, &WindowLayerDialog::saturationChanged);
	connect(m_ui.saturationBox, fpiSB,
		this, &WindowLayerDialog::saturationChanged);

	// Notify the dialog when settings change
	connect(m_ui.brightnessSlider, &QAbstractSlider::valueChanged,
		this, &LayerDialog::settingModified);
	connect(m_ui.brightnessBox, fpiSB,
		this, &LayerDialog::settingModified);
	connect(m_ui.contrastSlider, &QAbstractSlider::valueChanged,
		this, &LayerDialog::settingModified);
	connect(m_ui.contrastBox, fpiSB,
		this, &LayerDialog::settingModified);
	connect(m_ui.saturationSlider, &QAbstractSlider::valueChanged,
		this, &LayerDialog::settingModified);
	connect(m_ui.saturationBox, fpiSB,
		this, &LayerDialog::settingModified);
}
TodaysPlanWorkoutDownload::TodaysPlanWorkoutDownload(Context *context) : QDialog(context->mainWindow), context(context)
{

    nam = new QNetworkAccessManager(this);
    connect(nam, SIGNAL(sslErrors(QNetworkReply*, const QList<QSslError> & )), this, SLOT(onSslErrors(QNetworkReply*, const QList<QSslError> & )));

    setAttribute(Qt::WA_DeleteOnClose);
    setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint);
    setWindowTitle(tr("Download future workouts from Today's Plan"));

    // help
    HelpWhatsThis *help = new HelpWhatsThis(this);
    this->setWhatsThis(help->getWhatsThisText(HelpWhatsThis::MenuBar_Tools_Download_TP));

    // make the dialog a resonable size
    setMinimumWidth(650);
    setMinimumHeight(400);

    QVBoxLayout *layout = new QVBoxLayout;
    setLayout(layout);

    // TopLine Fields and Layout

    all = new QCheckBox(tr("check/uncheck all"), this);
    all->setChecked(true);

    QLabel *fromLabel = new QLabel(tr("From:"), this);
    QLabel *toLabel = new QLabel(tr("To:"), this);
    from = new QDateEdit(this);
    from->setDate(QDate::currentDate());
    from->setCalendarPopup(true);
    to = new QDateEdit(this);
    to->setDate(QDate::currentDate().addMonths(1));
    to->setCalendarPopup(true);

    refreshButton = new QPushButton(tr("Refresh List"), this);

    QHBoxLayout *topline = new QHBoxLayout;
    topline->addWidget(all);
    topline->addStretch();
    topline->addWidget(fromLabel);
    topline->addWidget(from);
    topline->addWidget(toLabel);
    topline->addWidget(to);
    topline->addStretch();
    topline->addWidget(refreshButton);

    // Filelist Widget

    files = new QTreeWidget;
#ifdef Q_OS_MAC
    files->setAttribute(Qt::WA_MacShowFocusRect, 0);
#endif
    files->headerItem()->setText(0, tr(""));
    files->headerItem()->setText(1, tr("Date"));
    files->headerItem()->setText(2, tr("Name"));
    files->headerItem()->setText(3, tr("T-Score"));
    files->headerItem()->setText(4, tr("Duration"));
    files->headerItem()->setText(5, tr("Action"));

    files->setColumnCount(6);
    files->setColumnWidth(0, 30*dpiXFactor); // selector
    files->setColumnWidth(1, 100*dpiXFactor); // date
    files->setColumnWidth(2, 220*dpiXFactor); // workout description
    files->setColumnWidth(3, 70*dpiXFactor); // T-Score
    files->setColumnWidth(4, 70*dpiXFactor); // duration
    files->setSelectionMode(QAbstractItemView::SingleSelection);
    files->setEditTriggers(QAbstractItemView::SelectedClicked); // allow edit
    files->setUniformRowHeights(true);
    files->setIndentation(0);

    // BottomLine Fields and Layout
    QHBoxLayout *bottomLine = new QHBoxLayout;
    status = new QLabel("", this);
    status->hide();
    overwrite = new QCheckBox(tr("Overwrite existing workouts"), this);
    close = new QPushButton(tr("Close"), this);
    download = new QPushButton(tr("Download"), this);
    bottomLine->addWidget(overwrite);
    bottomLine->addWidget(status);
    bottomLine->addStretch();
    bottomLine->addWidget(close);
    bottomLine->addWidget(download);

    layout->addLayout(topline);
    layout->addWidget(files);
    layout->addLayout(bottomLine);

    // connect signals and slots up..
    connect(download, SIGNAL(clicked()), this, SLOT(downloadClicked()));
    connect(all, SIGNAL(stateChanged(int)), this, SLOT(allClicked()));
    connect(close, SIGNAL(clicked()), this, SLOT(cancelClicked()));
    connect(refreshButton, SIGNAL(clicked()), this, SLOT(refreshClicked()));

    // fill the data
    refreshClicked();

}
Exemplo n.º 12
0
void WifiDialog::createLayout()
{
    // big_box_.setSizeConstraint(QLayout::SetMinimumSize);
    big_box_.setSpacing(SPACING);
    big_box_.setContentsMargins(SPACING, SPACING, SPACING, SPACING);

    // title hbox.
    big_box_.addLayout(&title_hbox_);
    title_hbox_.setContentsMargins(0, 0, 0, 0);
    title_hbox_.addWidget(&title_icon_label_, 0, Qt::AlignVCenter);
    title_hbox_.addSpacing(SPACING * 2);
    title_hbox_.addWidget(&title_text_label_, 0, Qt::AlignVCenter);
    title_hbox_.addStretch(0);
    title_hbox_.addWidget(&close_button_);
    title_icon_label_.setPixmap(QPixmap(":/images/network_connection.png"));
    title_text_label_.setAlignment(Qt::AlignVCenter);
    title_icon_label_.setFixedHeight(WIDGET_HEIGHT);
    title_text_label_.useTitleBarStyle();
    title_text_label_.setFixedHeight(WIDGET_HEIGHT);

    close_button_.setStyleSheet(BUTTON_STYLE);
    QPixmap close_pixmap(":/images/close.png");
    close_button_.setIconSize(close_pixmap.size());
    close_button_.setIcon(QIcon(close_pixmap));
    close_button_.setFocusPolicy(Qt::NoFocus);
    QObject::connect(&close_button_, SIGNAL(clicked()), this, SLOT(onCloseClicked()));

    // content layout.
    big_box_.addLayout(&content_layout_);
    content_layout_.setContentsMargins(MARGINS, MARGINS, MARGINS, MARGINS);

    // Status.
    state_widget_layout_.setContentsMargins(MARGINS, 0, MARGINS, 0);
    state_widget_layout_.addWidget(&state_widget_);
    content_layout_.addSpacing(10);
    content_layout_.addLayout(&state_widget_layout_);
    QObject::connect(&state_widget_, SIGNAL(refreshClicked()), this, SLOT(onRefreshClicked()));
    QObject::connect(&state_widget_, SIGNAL(customizedClicked()), this, SLOT(onCustomizedClicked()));
    QObject::connect(&prev_button_, SIGNAL(clicked()), &ap_view_, SLOT(goPrev()), Qt::QueuedConnection);
    QObject::connect(&next_button_, SIGNAL(clicked()), &ap_view_, SLOT(goNext()), Qt::QueuedConnection);

    // ap layout.
    ap_layout_.setContentsMargins(MARGINS, MARGINS, MARGINS, MARGINS);
    ap_layout_.setSpacing(5);
    content_layout_.addLayout(&ap_layout_);
    ap_layout_.addWidget(&ap_view_);

    QObject::connect(&ap_view_, SIGNAL(positionChanged(const int, const int)), this, SLOT(onPositionChanged(const int, const int)));
    QObject::connect(&ap_view_, SIGNAL(itemActivated(CatalogView*, ContentView*, int)), this, SLOT(onItemActivated(CatalogView*, ContentView*, int)));

    ap_view_.setPreferItemSize(QSize(-1, AP_ITEM_HEIGHT));
    ap_view_.setNeighbor(&state_widget_.dashBoard(), CatalogView::UP);
    content_layout_.addSpacing(50);

    // Buttons.
    content_layout_.addLayout(&buttons_layout_);
    buttons_layout_.setContentsMargins(MARGINS, 0, MARGINS, 0);
    prev_button_.setFocusPolicy(Qt::NoFocus);
    next_button_.setFocusPolicy(Qt::NoFocus);
    buttons_layout_.addWidget(&prev_button_);
    buttons_layout_.addStretch(0);
    buttons_layout_.addWidget(&next_button_);
    showPaginationButtons(true, true);

    // Hardware address.
    hardware_address_.setFixedHeight(WIDGET_HEIGHT);
    hardware_address_.setContentsMargins(MARGINS, 0, MARGINS, 0);
    content_layout_.addWidget(&hardware_address_);
}
Exemplo n.º 13
0
	void SensorDashboard::create()
	{
		mPeriodFrom = new QDateTimeEdit();
		mPeriodFrom->setDateTime(QDateTime::currentDateTime().addSecs(-60 * 60));
		mPeriodFrom->setDisplayFormat("MM/dd/yyyy HH:mm:ss");
		mPeriodFrom->setCalendarPopup(true);

		connect(mPeriodFrom, &QDateTimeEdit::dateTimeChanged, this, &SensorDashboard::periodFromChanged);

		mPeriodTo = new QDateTimeEdit();
		mPeriodTo->setDateTime(QDateTime::currentDateTime());
		mPeriodTo->setDisplayFormat("MM/dd/yyyy HH:mm:ss");
		mPeriodTo->setCalendarPopup(true);

		connect(mPeriodTo, &QDateTimeEdit::dateTimeChanged, this, &SensorDashboard::periodToChanged);

		mAutoRefresh = new QCheckBox(tr("Auto"));

		connect(mAutoRefresh, &QCheckBox::toggled, this, &SensorDashboard::autoRefreshToggled);

		mRefresh = new QPushButton(tr("Refresh"));

		connect(mRefresh, &QPushButton::clicked, this, &SensorDashboard::refreshClicked);

		QHBoxLayout *periodLayout = new QHBoxLayout();
		periodLayout->addWidget(new QLabel(tr("From")));
		periodLayout->addWidget(mPeriodFrom);
		periodLayout->addWidget(new QLabel(" to "));
		periodLayout->addWidget(mPeriodTo);
		periodLayout->addStretch();
		periodLayout->addWidget(mAutoRefresh);
		periodLayout->addWidget(mRefresh);

		mShowLegend = new QCheckBox(tr("Show legend"));
		mShowLegend->setChecked(true);

		connect(mShowLegend, &QCheckBox::toggled, this, &SensorDashboard::showLegendToggled);

		QHBoxLayout *optionsLayout = new QHBoxLayout();
		optionsLayout->addWidget(mShowLegend);
		optionsLayout->addStretch();

		mPlot = new QCustomPlot();
		mPlot->setNotAntialiasedElement(QCP::aeAll);
		mPlot->setNoAntialiasingOnDrag(true);

		connect(mPlot, &QCustomPlot::mouseWheel, this, &SensorDashboard::plotMouseWheel);

		mPlot->xAxis->grid()->setAntialiased(false);
		mPlot->yAxis->grid()->setAntialiased(false);

		mPlot->xAxis->grid()->setPen(QPen(QColor(200, 200, 200), 1, Qt::DotLine));
		mPlot->yAxis->grid()->setPen(QPen(QColor(200, 200, 200), 1, Qt::DotLine));
		mPlot->xAxis->grid()->setSubGridPen(QPen(QColor(160, 160, 160), 1, Qt::DotLine));
		mPlot->yAxis->grid()->setSubGridPen(QPen(QColor(160, 160, 160), 1, Qt::DotLine));
		mPlot->xAxis->grid()->setSubGridVisible(true);
		mPlot->yAxis->grid()->setSubGridVisible(true);

		mPlot->xAxis->setLabel("Timeline");
		mPlot->yAxis->setLabel("Data");

		mPlot->xAxis->setDateTimeFormat("HH:mm:ss\nMM/dd/yyyy");
		mPlot->xAxis->setTickLabelType(QCPAxis::ltDateTime);
		mPlot->xAxis->setTickStep(60);

		mPlot->axisRect()->setRangeDragAxes(mPlot->xAxis, nullptr);
		mPlot->axisRect()->setRangeZoomAxes(mPlot->xAxis, nullptr);

		mPlot->setInteraction(QCP::iRangeDrag, true);
		mPlot->setInteraction(QCP::iRangeZoom, true);

		mPlot->legend->setVisible(true);

		QVBoxLayout *dashboardLayout = new QVBoxLayout();
		dashboardLayout->addLayout(periodLayout);
		dashboardLayout->addLayout(optionsLayout);
		dashboardLayout->addWidget(mPlot);

		QGroupBox *dashboardGroupBox = new QGroupBox(tr("Dashboard"));
		dashboardGroupBox->setLayout(dashboardLayout);

		QVBoxLayout *layout = new QVBoxLayout();
		layout->addWidget(dashboardGroupBox);

		setLayout(layout);

		createEvent();

		refreshClicked();
	}