Example #1
0
void Cocos2dxView::mouseMoveInBrowse(QMouseEvent *event)
{
	qDebug("move browse");
	QPointF curPos = event->localPos();
	QPointF diff = curPos - m_prePosition;
	qDebug("diff: %f %f", diff.x(), diff.y());
	QScrollArea *scroll = (QScrollArea*)this->parent()->parent();

	scroll->horizontalScrollBar()->setValue(scroll->horizontalScrollBar()->value() - diff.x());
	scroll->verticalScrollBar()->setValue(scroll->verticalScrollBar()->value() - diff.y());

	m_prePosition = curPos;
}
MusicWebDJRadioCategoryWidget::MusicWebDJRadioCategoryWidget(QWidget *parent)
    : QWidget(parent)
{
    QHBoxLayout *layout = new QHBoxLayout(this);
    layout->setSpacing(0);
    layout->setContentsMargins(0, 0, 0, 0);
    setLayout(layout);

    QWidget *mainWindow = new QWidget(this);

    QScrollArea *scrollArea = new QScrollArea(this);
    scrollArea->verticalScrollBar()->setStyleSheet(MusicUIObject::MScrollBarStyle01);
    scrollArea->setWidgetResizable(true);
    scrollArea->setFrameShape(QFrame::NoFrame);
    scrollArea->setAlignment(Qt::AlignLeft);
    scrollArea->setWidget(mainWindow);
    layout->addWidget(scrollArea);

    m_gridLayout = new QGridLayout(mainWindow);
    m_gridLayout->setVerticalSpacing(35);
    mainWindow->setLayout(m_gridLayout);

    m_categoryThread = new MusicDJRadioCategoryThread(this);
    connect(m_categoryThread, SIGNAL(downLoadDataChanged(QString)), SLOT(createCategoryItems()));
}
void NLSimpleGuiWindow::zoomModelPreview( double factor )
{
  TQtWidget *qtWidget = ui->m_modelDisplayWidget;
  QScrollArea *scrollArea = ui->m_modelDisplayScrollArea;
  TCanvas *can = qtWidget->GetCanvas();
  can->SetEditable( kTRUE );
  can->Update(); //need this or else TCanvas won't have updated axis range

  double xmin, xmax, ymin, ymax;
  can->GetRangeAxis( xmin, ymin, xmax, ymax );
  const double nMinutes = xmax - xmin;

  if( nMinutes > 1 )
  {
    int canvasWidth = qtWidget->width();
    int scrollAreaWidth = scrollArea->width();

    int newWidth = factor * canvasWidth;
    newWidth = max(newWidth, scrollAreaWidth);
    newWidth = min(newWidth, 5*scrollAreaWidth);

    if( newWidth == scrollAreaWidth )
       scrollArea->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
    else scrollArea->setHorizontalScrollBarPolicy ( Qt::ScrollBarAsNeeded );

    int h = scrollArea->height() - scrollArea->verticalScrollBar()->height();
    qtWidget->setMinimumSize( newWidth, h );
    qtWidget->setMaximumSize( newWidth, h );
  }//if( nMinutes > 1 )

  can->Update();
  can->SetEditable( kFALSE );
}//void NLSimpleGuiWindow::zoomModelPreview( double factor )
void DlgPreferencesImp::resizeEvent(QResizeEvent* ev)
{
    if (canEmbedScrollArea) {
        // embed the widget stack into a scroll area if the size is
        // bigger than the available desktop
        QRect rect = QApplication::desktop()->availableGeometry();
        int maxHeight = rect.height();
        int maxWidth = rect.width();
        if (height() > maxHeight || width() > maxWidth) {
            canEmbedScrollArea = false;
            ui->hboxLayout->removeWidget(ui->tabWidgetStack);
            QScrollArea* scrollArea = new QScrollArea(this);
            scrollArea->setFrameShape(QFrame::NoFrame);
            scrollArea->setWidgetResizable(true);
            scrollArea->setWidget(ui->tabWidgetStack);
            ui->hboxLayout->addWidget(scrollArea);

            // if possible the minimum width should so that it doesn't show
            // a horizontal scroll bar.
            QScrollBar* bar = scrollArea->verticalScrollBar();
            if (bar) {
                int newWidth = width() + bar->width();
                newWidth = std::min<int>(newWidth, maxWidth);
                int newHeight = std::min<int>(height(), maxHeight-30);
                QMetaObject::invokeMethod(this, "resizeWindow",
                    Qt::QueuedConnection,
                    QGenericReturnArgument(),
                    Q_ARG(int, newWidth),
                    Q_ARG(int, newHeight));
            }
        }
    }
Example #5
0
void PatternEditorPanel::resizeEvent( QResizeEvent *ev )
{
	UNUSED( ev );
	QScrollArea *pScrollArea = m_pEditorScrollView;


	pScrollArea = m_pEditorScrollView;

	m_pPatternEditorHScrollBar->setMinimum( pScrollArea->horizontalScrollBar()->minimum() );
	m_pPatternEditorHScrollBar->setMaximum( pScrollArea->horizontalScrollBar()->maximum() );
	m_pPatternEditorHScrollBar->setSingleStep( pScrollArea->horizontalScrollBar()->singleStep() );
	m_pPatternEditorHScrollBar->setPageStep( pScrollArea->horizontalScrollBar()->pageStep() );

	m_pPatternEditorVScrollBar->setMinimum( pScrollArea->verticalScrollBar()->minimum() );
	m_pPatternEditorVScrollBar->setMaximum( pScrollArea->verticalScrollBar()->maximum() );
	m_pPatternEditorVScrollBar->setSingleStep( pScrollArea->verticalScrollBar()->singleStep() );
	m_pPatternEditorVScrollBar->setPageStep( pScrollArea->verticalScrollBar()->pageStep() );
}
Example #6
0
bool MainWindow::eventFilter( QObject * object, QEvent * event )
{
    QScrollArea * scrollArea = ui->scrollArea;
    if ( object == scrollArea )
    {
        if ( event->type() == QEvent::MouseButtonPress )
        {
            QMouseEvent * mouseEvent = static_cast < QMouseEvent * > ( event );
            if ( mouseEvent->button() == Qt::LeftButton )
            {
                lastPos = mouseEvent->pos();

                if( scrollArea->horizontalScrollBar()->isVisible() || scrollArea->verticalScrollBar()->isVisible() )
                    scrollArea->setCursor( Qt::ClosedHandCursor );
                else
                    scrollArea->setCursor( Qt::ArrowCursor );
            }

        }else if ( event->type() == QEvent::MouseMove )
        {
            QMouseEvent *mouseEvent = static_cast < QMouseEvent * > ( event );

            if ( mouseEvent->buttons() == Qt::LeftButton )
            {
                lastPos -= mouseEvent->pos();

                int hValue = scrollArea->horizontalScrollBar()->value();
                int vValue = scrollArea->verticalScrollBar()->value();

                scrollArea->horizontalScrollBar()->setValue( lastPos.x() + hValue );
                scrollArea->verticalScrollBar()->setValue( lastPos.y() + vValue );

                lastPos = mouseEvent->pos();
            }

        }else if ( event->type() == QEvent::MouseButtonRelease )
            scrollArea->setCursor( Qt::ArrowCursor );
    }

    return QWidget::eventFilter(object, event);
}
NotifyManager::NotifyManager(QWidget *parent) :
    QWidget(parent),
    m_dbus(new Notification("com.deepin.dde.Notification", "/com/deepin/dde/Notification", QDBusConnection::sessionBus(), this))
{
    QWidget *widget = new QWidget;

    m_connectLayout = new QVBoxLayout(widget);
    m_connectLayout->setMargin(0);
    m_connectLayout->setSpacing(1);
    m_connectLayout->addStretch();

    QScrollArea *scrollarea = new QScrollArea;
    scrollarea->setWidget(widget);
    scrollarea->setObjectName("scrollarea");
    scrollarea->setWidgetResizable(true);
    scrollarea->setFocusPolicy(Qt::NoFocus);
    scrollarea->setFrameStyle(QFrame::NoFrame);
    scrollarea->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Expanding);
    scrollarea->setContentsMargins(0, 0, 0, 0);
    scrollarea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    scrollarea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    scrollarea->setStyleSheet("background-color:transparent;");

    QScrollBar *bar = scrollarea->verticalScrollBar();
    connect(bar, &QScrollBar::valueChanged, this, [=](int value){
            if (m_checkIndex && value == bar->maximum())
                onLoadAgain();
    });

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->setMargin(0);
    mainLayout->setSpacing(0);

    m_clearButton = new DImageButton;
    m_clearButton->setText(tr("Clear all"));
    m_clearButton->setStyleSheet("padding: 4px 0;");

    mainLayout->addWidget(m_clearButton, 0, Qt::AlignHCenter);
    mainLayout->addWidget(scrollarea);

    setLayout(mainLayout);

    m_clearButton->setVisible(false);

    connect(m_clearButton, &DImageButton::clicked, this, &NotifyManager::onCloseAllItem);
    connect(m_dbus, &Notification::RecordAdded, this, &NotifyManager::onNotifyAdded);

    m_dbus->setSync(false);

    QDBusPendingReply<QString> notify = m_dbus->GetAllRecords();
    QDBusPendingCallWatcher *notifyWatcher = new QDBusPendingCallWatcher(notify, this);
    connect(notifyWatcher, &QDBusPendingCallWatcher::finished, this, &NotifyManager::onNotifyGetAllFinished);
}
ExtremeDownloadDialog::ExtremeDownloadDialog(QWidget *parent) :
    QDialog(parent)
{
    QVBoxLayout *mainLayout = new QVBoxLayout;

    QScrollArea *scrollArea = new QScrollArea;
    scrollArea->setWidgetResizable(true);
    scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);

    scrollBar = scrollArea->verticalScrollBar();

    QWidget *contents = new QWidget;
    scrollArea->setWidget(contents);

    grid = new QGridLayout(contents);

    manager = new QNetworkAccessManager;
    pageNumber = 1;

    QNetworkRequest request(QUrl( QString("http://www.extreme-down.net/films-sd/dvdrip/page/%1/").arg(pageNumber++) ));
    QNetworkReply *reply = manager->get(request);
    connect(reply,SIGNAL(finished()),this,SLOT(extract()));

    QScrollBar *scroll = scrollArea->verticalScrollBar();
    connect(scroll,SIGNAL(valueChanged(int)),this,SLOT(needMore(int)));


    QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);

    connect(buttonBox,SIGNAL(accepted()),this,SLOT(accept()));
    connect(buttonBox,SIGNAL(rejected()),this,SLOT(reject()));

    mainLayout->addWidget(scrollArea);
    mainLayout->addWidget(buttonBox);

    this->setLayout(mainLayout);
}
Example #9
0
    void CChatWidget::initWidget()
    {
        QGridLayout* pMainLayout = new QGridLayout(this);
        setLayout(pMainLayout);

        m_pChatListWidget = new QWidget(this);
        pMainLayout->addWidget(m_pChatListWidget, 0, 0, 10, 2, Qt::AlignLeft);

        m_pPeerInfoWidget = new QWidget(this);
        pMainLayout->addWidget(m_pPeerInfoWidget, 0, 2, 2, 8);
        QHBoxLayout* pPeerInfoLayout = new QHBoxLayout(m_pPeerInfoWidget);
        m_pPeerInfoWidget->setLayout(pPeerInfoLayout);
        pPeerInfoLayout->addWidget(new QLabel(tr("name"), m_pPeerInfoWidget));
        pPeerInfoLayout->addWidget(new QLabel(tr("ip"), m_pPeerInfoWidget));
        pPeerInfoLayout->addWidget(new QLabel(tr("port"), m_pPeerInfoWidget));

        m_pRecordWidget = new QWidget(this);
        m_pRecordWidget->setLayout(new QVBoxLayout(m_pRecordWidget));
        QScrollArea* pLogArea = new QScrollArea(this);
        pLogArea->setWidget(m_pRecordWidget);
        pLogArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
        pLogArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
        pMainLayout->addWidget(pLogArea, 2, 2, 5, 8);

        pLogArea->setWidgetResizable(true);
        pLogArea->setStyleSheet(
                    "QWidget{background-color: transparent;} QScrollArea{background-color: rgba(255, 255, 255, 59);}");

        m_psbRecord = pLogArea->verticalScrollBar();

        QWidget* pInputWidget = new QWidget(this);
        pMainLayout->addWidget(pInputWidget, 7, 2, 3, 8);
        QHBoxLayout* pInputLayout = new QHBoxLayout(pInputWidget);
        pInputWidget->setLayout(pInputLayout);
        m_pteInput = new QTextEdit(pInputWidget);
        pInputLayout->addWidget(m_pteInput);
        QPushButton* pbtnSend = new QPushButton(tr("send"), pInputWidget);
        pInputLayout->addWidget(pbtnSend);

        bool VARIABLE_IS_NOT_USED bIsSendConOK = connect(pbtnSend, SIGNAL(clicked()), this, SLOT(sendButtonClicked()));
        Q_ASSERT(bIsSendConOK);
    }
Example #10
0
void
WPiano::look_at_cursor(LookMode mode)
{
	QWidget *viewport_widget = qobject_cast<QWidget *>(parent());
	if (viewport_widget == NULL)
		return;
	QScrollArea *scroll = qobject_cast<QScrollArea *>(viewport_widget->parent());
	if (scroll == NULL)
		return;
	QScrollBar *hs = scroll->horizontalScrollBar();
	QScrollBar *vs = scroll->verticalScrollBar();

	bool pl = playing();
	QRect v = viewport();
	int x1, x2, y1, y2;
	x1 = time2x(cursorTime());
	x2 = pl ? x1 + 1 : time2x(cursorEndTime());
	y1 = level2y(cursor_level_ + 1);
	y2 = level2y(cursor_level_ - 1);

	switch (mode) {
	case PAGE:
		if (x1 < v.left())
			hs->setValue(scroll_snap(this, x2 - v.width(), true));
		if (x2 > v.right())
			hs->setValue(scroll_snap(this, x1 - 1));
		if (pl && y1 < v.top())
			vs->setValue(y2 - v.height() + level_height);
		if (pl && y2 > v.bottom())
			vs->setValue(y1 - level_height);
		break;
	case MINSCROLL:
		scroll->ensureVisible(x1, y1, level_height, level_height);
		scroll->ensureVisible(x2, y2, level_height, level_height);
		break;
	case CENTER:
		hs->setValue((x1 + x2 - v.width()) / 2);
		vs->setValue((y1 + y2 - v.height()) / 2);
		break;
	}
}
Example #11
0
/** Called when the mouse is being moved */
void CMapWidget::mouseMoveEvent(QMouseEvent *e)
{
	if (bMouseDrag)
 	{
		int dx, dy;
 		dx = e->globalX() - nMouseDragPosX;
		dy = e->globalY() - nMouseDragPosY;
		nMouseDragPosX = e->globalX();
		nMouseDragPosY = e->globalY();
		QScrollArea *parent = (QScrollArea *) parentWidget();
                QScrollBar *sx = parent->horizontalScrollBar();
                QScrollBar *sy = parent->verticalScrollBar();
                sx->setValue(sx->value() + dx*3);
                sy->setValue(sy->value() + dy*3);
	}
	else
	{
		// Send the mouse event to the current tool
		mapManager->getCurrentTool()->mouseMoveEvent(e->pos(),e->button(),viewWidget->getCurrentlyViewedLevel());
  	}
}
void CTestSettingWindow::idButtonClicked()
{
    if(_idText->text().length()>0 &&_idText->text().length()<10 )
        ((CApp*)qApp)->addTestJobFromID(_idText->text());
    ((CApp*)qApp)->sleep(5); //适当延时,让scrollarea自动变长后再自动滚动
    QScrollArea* pscroll = qobject_cast<QScrollArea*>(parentWidget()->parentWidget());
    pscroll->verticalScrollBar()->setValue(300);

    ((CApp*)qApp)->_meter = new CMeter("014758");
    int iRet = QMessageBox::question(this, "警告", "选择了检测批号 014758,点击确定开始检测,点击否认重新选择。",
                                     QMessageBox::Yes, QMessageBox::No);
    if(iRet == QMessageBox::No)
        return;
    else
    {
        ((CApp*)qApp)->startJob();
        ((CApp*)qApp)->_tjob->_mconfig = _mconfig;
        ((CApp*)qApp)->_tjob->_aconfig = _aconfig;
 //       ((CApp*)qApp)->_tjob->_tr = t[r];

 //       setProperty("testid", _testList->item(r,0)->text());
        emit toTestTabPage(FULLTEST_ID);
    }
}
Example #13
0
GpsStatusDialog::GpsStatusDialog(QWidget * parent) :
  QWidget( parent ),
  showNmeaData( true ),
  nmeaLines( 0 ),
  cntSIVSentence( 1 )
{
  noOfInstances++;

  setWindowTitle(tr("GPS Status"));
  setWindowFlags( Qt::Tool );
  setWindowModality( Qt::WindowModal );
  setAttribute(Qt::WA_DeleteOnClose);

  if( _globalMainWindow )
    {
      // Resize the window to the same size as the main window has. That will
      // completely hide the parent window.
      resize( _globalMainWindow->size() );
    }

  uTimer = new QTimer( this );
  uTimer->setSingleShot( true );

  connect( uTimer, SIGNAL(timeout()), this,
           SLOT(slot_updateGpsMessageDisplay()) );

  elevAziDisplay = new GpsElevationAzimuthDisplay(this);
  snrDisplay     = new GpsSnrDisplay(this);

  nmeaBox = new QLabel;
  nmeaBox->setObjectName("NmeaBox");
  nmeaBox->setTextFormat(Qt::PlainText);
  nmeaBox->setBackgroundRole( QPalette::Light );
  nmeaBox->setAutoFillBackground( true );
  nmeaBox->setMargin(5);

  QFont f = font();

#if defined MAEMO
  f.setPixelSize(16);
#elif ANDROID
  f.setPointSize(6);
#else
  f.setPixelSize(14);
#endif

  nmeaBox->setFont(f);

  QScrollArea *nmeaScrollArea = new QScrollArea;
  nmeaScrollArea->setWidgetResizable( true );
  nmeaScrollArea->setWidget(nmeaBox);

#ifdef ANDROID
  // Make the vertical scrollbar bigger for Android
  QScrollBar* vsb = nmeaScrollArea->verticalScrollBar();
  vsb->setStyleSheet( Layout::getCbSbStyle() );
#endif

#ifdef QSCROLLER
  QScroller::grabGesture( nmeaScrollArea->viewport(), QScroller::LeftMouseButtonGesture );
#endif

#ifdef QTSCROLLER
  QtScroller::grabGesture( nmeaScrollArea->viewport(), QtScroller::LeftMouseButtonGesture );
#endif

  QVBoxLayout* nmeaBoxLayout = new QVBoxLayout;
  nmeaBoxLayout->setSpacing( 0 );
  nmeaBoxLayout->addWidget( nmeaScrollArea );

  satSource = new QComboBox;
  satSource->setToolTip( tr("GPS source filter") );
  satSource->addItem( "$GP" );
  satSource->addItem( "$BD" );
  satSource->addItem( "$GA" );
  satSource->addItem( "$GL" );
  satSource->addItem( "$GN" );
  satSource->addItem( "ALL" );

  startStop = new QPushButton( tr("Stop"), this );
  save      = new QPushButton( tr("Save"), this );

  QPushButton* close = new QPushButton( tr("Close"), this );

  QVBoxLayout* buttonBox = new QVBoxLayout;
  buttonBox->addWidget( satSource );
  buttonBox->addStretch( 5 );
  buttonBox->addWidget( startStop );
  buttonBox->addSpacing( 5 );
  buttonBox->addWidget( save );
  buttonBox->addSpacing( 5 );
  buttonBox->addWidget( close );

  QHBoxLayout* hBox = new QHBoxLayout;
  hBox->addWidget(elevAziDisplay, 1);
  hBox->addWidget(snrDisplay, 2);
  hBox->addLayout( buttonBox );

  QVBoxLayout* topLayout = new QVBoxLayout( this );
  topLayout->addLayout( hBox );
  topLayout->addLayout( nmeaBoxLayout );

  connect( satSource, SIGNAL(currentIndexChanged(int)),
                      SLOT(slot_GpsSourceChanged(int)) );

  connect( GpsNmea::gps, SIGNAL(newSentence(const QString&)),
           this, SLOT(slot_Sentence(const QString&)) );

  connect( startStop, SIGNAL(clicked()), this, SLOT(slot_ToggleStartStop()) );

  connect( save, SIGNAL(clicked()), this, SLOT(slot_SaveNmeaData()) );

  connect( close, SIGNAL(clicked()), this, SLOT(slot_Close()) );
}
SettingsPageUnits::SettingsPageUnits(QWidget *parent) : QWidget(parent)
{
  setObjectName("SettingsPageUnits");
  setWindowFlags( Qt::Tool );
  setWindowModality( Qt::WindowModal );
  setAttribute(Qt::WA_DeleteOnClose);
  setWindowTitle( tr("Settings - Units") );

  if( parent )
    {
      resize( parent->size() );
    }

  // Layout used by scroll area
  QHBoxLayout *sal = new QHBoxLayout;

  // new widget used as container for the dialog layout.
  QWidget* sw = new QWidget;

  // Scroll area
  QScrollArea* sa = new QScrollArea;
  sa->setWidgetResizable( true );
  sa->setFrameStyle( QFrame::NoFrame );
  sa->setWidget( sw );

#ifdef ANDROID
  QScrollBar* lvsb = sa->verticalScrollBar();
  lvsb->setStyleSheet( Layout::getCbSbStyle() );
#endif

#ifdef QSCROLLER
  QScroller::grabGesture( sa->viewport(), QScroller::LeftMouseButtonGesture );
#endif

#ifdef QTSCROLLER
  QtScroller::grabGesture( sa->viewport(), QtScroller::LeftMouseButtonGesture );
#endif

  // Add scroll area to its own layout
  sal->addWidget( sa );

  QHBoxLayout *contentLayout = new QHBoxLayout;
  setLayout(contentLayout);

  // Pass scroll area layout to the content layout.
  contentLayout->addLayout( sal, 10 );

  // The parent of the layout is the scroll widget
  QGridLayout *topLayout = new QGridLayout(sw);

  int row=0;

  QLabel *label = new QLabel(tr("Altitude:"), this);
  topLayout->addWidget(label, row, 0);
  UnitAlt = new QComboBox(this);
  UnitAlt->setObjectName("UnitAlt");
  UnitAlt->setEditable(false);
  topLayout->addWidget(UnitAlt,row++,1);
  UnitAlt->addItem(tr("meters"));
  UnitAlt->addItem(tr("feet"));
  altitudes[0] = int(Altitude::meters);
  altitudes[1] = int(Altitude::feet);

  label = new QLabel(tr("Speed:"), this);
  topLayout->addWidget(label, row, 0);
  UnitSpeed = new QComboBox(this);
  UnitSpeed->setObjectName("UnitSpeed");
  UnitSpeed->setEditable(false);
  topLayout->addWidget(UnitSpeed,row++,1);
  UnitSpeed->addItem(tr("meters per second"));
  UnitSpeed->addItem(tr("kilometers per hour"));
  UnitSpeed->addItem(tr("knots"));
  UnitSpeed->addItem(tr("miles per hour"));
  speeds[0] = Speed::metersPerSecond;
  speeds[1] = Speed::kilometersPerHour;
  speeds[2] = Speed::knots;
  speeds[3] = Speed::milesPerHour;

  label = new QLabel(tr("Distance:"), this);
  topLayout->addWidget(label, row, 0);
  UnitDistance = new QComboBox(this);
  UnitDistance->setObjectName("UnitDistance");
  UnitDistance->setEditable(false);
  topLayout->addWidget(UnitDistance,row++,1);
  UnitDistance->addItem(tr("kilometers"));
  UnitDistance->addItem(tr("statute miles"));
  UnitDistance->addItem(tr("nautical miles"));
  distances[0] = Distance::kilometers;
  distances[1] = Distance::miles;
  distances[2] = Distance::nautmiles;

  label = new QLabel(tr("Vario:"), this);
  topLayout->addWidget(label, row, 0);
  UnitVario = new QComboBox(this);
  UnitVario->setObjectName("UnitVario");
  UnitVario->setEditable(false);
  topLayout->addWidget(UnitVario,row++,1);
  UnitVario->addItem(tr("meters per second"));
  UnitVario->addItem(tr("feet per minute"));
  UnitVario->addItem(tr("knots"));
  varios[0] = Speed::metersPerSecond;
  varios[1] = Speed::feetPerMinute;
  varios[2] = Speed::knots;

  label = new QLabel(tr("Wind:"), this);
  topLayout->addWidget(label, row, 0);
  UnitWind = new QComboBox(this);
  UnitWind->setObjectName("UnitWind");
  UnitWind->setEditable(false);
  topLayout->addWidget(UnitWind,row++,1);
  UnitWind->addItem(tr("meters per second"));
  UnitWind->addItem(tr("kilometers per hour"));
  UnitWind->addItem(tr("knots"));
  UnitWind->addItem(tr("miles per hour"));
  winds[0] = Speed::metersPerSecond;
  winds[1] = Speed::kilometersPerHour;
  winds[2] = Speed::knots;
  winds[3] = Speed::milesPerHour;

  label = new QLabel(tr("Position:"), this);
  topLayout->addWidget(label, row, 0);
  UnitPosition = new QComboBox(this);
  UnitPosition->setObjectName("UnitPosition");
  UnitPosition->setEditable(false);
  topLayout->addWidget(UnitPosition,row++,1);
  UnitPosition->addItem(QString("ddd") + Qt::Key_degree + "mm'ss\"");
  UnitPosition->addItem(QString("ddd") + Qt::Key_degree + "mm.mmm'");
  UnitPosition->addItem(QString("ddd.ddddd") + Qt::Key_degree);
  positions[0] = WGSPoint::DMS;
  positions[1] = WGSPoint::DDM;
  positions[2] = WGSPoint::DDD;

  label = new QLabel(tr("Time:"), this);
  topLayout->addWidget(label, row, 0);
  UnitTime = new QComboBox(this);
  UnitTime->setObjectName("UnitTime");
  UnitTime->setEditable(false);
  topLayout->addWidget(UnitTime,row++,1);
  UnitTime->addItem(tr("UTC"));
  UnitTime->addItem(tr("Local"));
  times[0] = Time::utc;
  times[1] = Time::local;

  label = new QLabel(tr("Temperature:"), this);
  topLayout->addWidget(label, row, 0);
  UnitTemperature = new QComboBox(this);
  UnitTemperature->setObjectName("UnitTemperature");
  UnitTemperature->setEditable(false);
  topLayout->addWidget(UnitTemperature,row++,1);
  UnitTemperature->addItem(tr("Celsius"));
  UnitTemperature->addItem(tr("Fahrenheit"));
  temperature[0] = GeneralConfig::Celsius;
  temperature[1] = GeneralConfig::Fahrenheit;

  label = new QLabel(tr("Air Pressure:"), this);
  topLayout->addWidget(label, row, 0);
  UnitAirPressure = new QComboBox(this);
  UnitAirPressure->setObjectName("UnitAirPressure");
  UnitAirPressure->setEditable(false);
  topLayout->addWidget(UnitAirPressure,row++,1);
  UnitAirPressure->addItem(tr("hPa"));
  UnitAirPressure->addItem(tr("inHg"));
  airPressure[0] = GeneralConfig::hPa;
  airPressure[1] = GeneralConfig::inHg;

  topLayout->setRowStretch(row++, 10);
  topLayout->setColumnStretch(2, 10);

  QPushButton *help = new QPushButton(this);
  help->setIcon(QIcon(GeneralConfig::instance()->loadPixmap("help32.png")));
  help->setIconSize(QSize(Layout::getButtonSize(12), Layout::getButtonSize(12)));
  help->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::QSizePolicy::Preferred);

  QPushButton *cancel = new QPushButton(this);
  cancel->setIcon(QIcon(GeneralConfig::instance()->loadPixmap("cancel.png")));
  cancel->setIconSize(QSize(Layout::getButtonSize(12), Layout::getButtonSize(12)));
  cancel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::QSizePolicy::Preferred);

  QPushButton *ok = new QPushButton(this);
  ok->setIcon(QIcon(GeneralConfig::instance()->loadPixmap("ok.png")));
  ok->setIconSize(QSize(Layout::getButtonSize(12), Layout::getButtonSize(12)));
  ok->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::QSizePolicy::Preferred);

  QLabel *titlePix = new QLabel(this);
  titlePix->setAlignment( Qt::AlignCenter );
  titlePix->setPixmap(GeneralConfig::instance()->loadPixmap("setup.png"));

  connect(help, SIGNAL(pressed()), this, SLOT(slotHelp()));
  connect(ok, SIGNAL(pressed()), this, SLOT(slotAccept()));
  connect(cancel, SIGNAL(pressed()), this, SLOT(slotReject()));

  QVBoxLayout *buttonBox = new QVBoxLayout;
  buttonBox->setSpacing(0);
  buttonBox->addWidget(help, 1);
  buttonBox->addStretch(2);
  buttonBox->addWidget(cancel, 1);
  buttonBox->addSpacing(30);
  buttonBox->addWidget(ok, 1);
  buttonBox->addStretch(2);
  buttonBox->addWidget(titlePix);
  contentLayout->addLayout(buttonBox);

  load();
}
void MusicWebDJRadioInfoWidget::createLabels()
{
    initFirstWidget();
    m_container->show();

    layout()->removeWidget(m_mainWindow);
    QScrollArea *scrollArea = new QScrollArea(this);
    scrollArea->verticalScrollBar()->setStyleSheet(MusicUIObject::MScrollBarStyle01);
    scrollArea->setWidgetResizable(true);
    scrollArea->setFrameShape(QFrame::NoFrame);
    scrollArea->setAlignment(Qt::AlignLeft);
    scrollArea->setWidget(m_mainWindow);
    layout()->addWidget(scrollArea);

    QWidget *function = new QWidget(m_mainWindow);
    function->setStyleSheet(MusicUIObject::MCheckBoxStyle01 + MusicUIObject::MPushButtonStyle03);
    QVBoxLayout *grid = new QVBoxLayout(function);

    QWidget *firstTopFuncWidget = new QWidget(function);
    QHBoxLayout *firstTopFuncLayout = new QHBoxLayout(firstTopFuncWidget);
    QLabel *firstLabel = new QLabel(function);
    firstLabel->setText(tr("<font color=#158FE1> DJRadio > %1 </font>").arg(m_currentPlaylistItem.m_name));
    QPushButton *backButton = new QPushButton(tr("Back"));
    backButton->setFixedSize(90, 30);
    backButton->setStyleSheet(MusicUIObject::MPushButtonStyle03);
    backButton->setCursor(QCursor(Qt::PointingHandCursor));
    connect(backButton, SIGNAL(clicked()), this, SIGNAL(backToMainMenu()));
    firstTopFuncLayout->addWidget(firstLabel);
    firstTopFuncLayout->addWidget(backButton);
    grid->addWidget(firstTopFuncWidget);
    ////////////////////////////////////////////////////////////////////////////
    QWidget *topFuncWidget = new QWidget(function);
    QHBoxLayout *topFuncLayout = new QHBoxLayout(topFuncWidget);

    m_iconLabel = new QLabel(topFuncWidget);
    m_iconLabel->setPixmap(QPixmap(":/image/lb_warning").scaled(180, 180));
    m_iconLabel->setFixedSize(210, 180);
    ////////////////////////////////////////////////////////////////////////////

    QWidget *topLineWidget = new QWidget(topFuncWidget);
    QVBoxLayout *topLineLayout = new QVBoxLayout(topLineWidget);
    topLineLayout->setContentsMargins(10, 5, 5, 0);
    QLabel *nameLabel = new QLabel(topLineWidget);
    QFont nameFont = nameLabel->font();
    nameFont.setPixelSize(20);
    nameLabel->setFont(nameFont);
    nameLabel->setStyleSheet(MusicUIObject::MFontStyle01);
    nameLabel->setText("-");
    QLabel *singerLabel = new QLabel(topLineWidget);
    singerLabel->setStyleSheet(MusicUIObject::MColorStyle04 + MusicUIObject::MFontStyle03);
    singerLabel->setText("-");
    QLabel *playCountLabel = new QLabel(topLineWidget);
    playCountLabel->setStyleSheet(MusicUIObject::MColorStyle04 + MusicUIObject::MFontStyle03);
    QLabel *updateTimeLabel = new QLabel(topLineWidget);
    updateTimeLabel->setStyleSheet(MusicUIObject::MColorStyle04 + MusicUIObject::MFontStyle03);
    updateTimeLabel->setText("-");

    topLineLayout->addWidget(nameLabel);
    topLineLayout->addWidget(singerLabel);
    topLineLayout->addWidget(playCountLabel);
    topLineLayout->addWidget(updateTimeLabel);
    topLineWidget->setLayout(topLineLayout);

    topFuncLayout->addWidget(m_iconLabel);
    topFuncLayout->addWidget(topLineWidget);
    topFuncWidget->setLayout(topFuncLayout);
    grid->addWidget(topFuncWidget);
    ////////////////////////////////////////////////////////////////////////////

    QWidget *functionWidget = new QWidget(this);
    functionWidget->setStyleSheet(MusicUIObject::MPushButtonStyle03);
    QHBoxLayout *hlayout = new QHBoxLayout(functionWidget);
    m_songButton = new QPushButton(functionWidget);
    m_songButton->setText(tr("songItems"));
    m_songButton->setFixedSize(100, 25);
    m_songButton->setCursor(QCursor(Qt::PointingHandCursor));
    hlayout->addWidget(m_songButton);
    hlayout->addStretch(1);
    functionWidget->setLayout(hlayout);
    QButtonGroup *group = new QButtonGroup(this);
    group->addButton(m_songButton, 0);
    connect(group, SIGNAL(buttonClicked(int)), m_container, SLOT(setCurrentIndex(int)));

#ifdef Q_OS_UNIX
    m_songButton->setFocusPolicy(Qt::NoFocus);
#endif
    grid->addWidget(functionWidget);
    //////////////////////////////////////////////////////////////////////
    grid->addWidget(m_container);
    grid->addStretch(1);

    function->setLayout(grid);
    m_mainWindow->layout()->addWidget(function);

    m_resizeWidgets << nameLabel << singerLabel << playCountLabel << updateTimeLabel;
}
void CellMLAnnotationViewMetadataEditDetailsWidget::updateGui(const Items &pItems,
                                                              const QString &pErrorMsg,
                                                              const bool &pLookupTerm,
                                                              const int &pItemsVerticalScrollBarPosition,
                                                              const bool &pRetranslate)
{
    // Note: we are using certain layouts to dislay the contents of our view,
    //       but this unfortunately results in some very bad flickering on OS X.
    //       This can, however, be addressed using a stacked widget, so...

    // Prevent ourselves from being updated (to avoid any flickering)

    setUpdatesEnabled(false);

    // Create a widget which will contain our GUI

    QWidget *newMainWidget = new QWidget(this);
    QVBoxLayout *newMainLayout = new QVBoxLayout(newMainWidget);

    newMainLayout->setMargin(0);

    newMainWidget->setLayout(newMainLayout);

    // Create a form widget which will contain our qualifier and term fields

    QWidget *newFormWidget = new QWidget(newMainWidget);
    QFormLayout *newFormLayout = new QFormLayout(newFormWidget);

    newFormWidget->setLayout(newFormLayout);

    // Add our qualifier field

    // Create a widget which will contain both our qualifier value widget and a
    // button to look up the qualifier

    QWidget *qualifierWidget = new QWidget(newFormWidget);

    QHBoxLayout *qualifierWidgetLayout = new QHBoxLayout(qualifierWidget);

    qualifierWidgetLayout->setMargin(0);

    qualifierWidget->setLayout(qualifierWidgetLayout);

    // Create our qualifier value widget

    mQualifierValue = new QComboBox(qualifierWidget);

    mQualifierValue->addItems(CellMLSupport::CellMLFileRdfTriple::qualifiersAsStringList());

    mQualifierValue->setCurrentIndex(mQualifierIndex);

    connect(mQualifierValue, SIGNAL(currentIndexChanged(int)),
            this, SLOT(qualifierChanged(const int &)));
    connect(mQualifierValue, SIGNAL(currentIndexChanged(const QString &)),
            this, SLOT(qualifierChanged(const QString &)));

    // Create our qualifier lookup button widget

    mLookupQualifierButton = new QPushButton(qualifierWidget);
    // Note #1: ideally, we could assign a QAction to our QPushButton, but this
    //          cannot be done, so... we assign a few properties by hand...
    // Note #2: to use a QToolButton would allow us to assign a QAction to it,
    //          but a QToolButton doesn't look quite the same as a QPushButton
    //          on some platforms, so...

    mLookupQualifierButton->setCheckable(true);
    mLookupQualifierButton->setChecked(mLookupQualifierButtonIsChecked);
    mLookupQualifierButton->setIcon(QIcon(":/oxygen/categories/applications-internet.png"));
    mLookupQualifierButton->setStatusTip(tr("Look up the qualifier"));
    mLookupQualifierButton->setToolTip(tr("Look Up"));
    mLookupQualifierButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);

    connect(mLookupQualifierButton, SIGNAL(clicked()),
            this, SLOT(lookupQualifier()));

    // Add our QComboBox and QPushButton to our cmeta:id widget

    qualifierWidgetLayout->addWidget(mQualifierValue);
    qualifierWidgetLayout->addWidget(mLookupQualifierButton);

    // Add our qualifier widget to our main layout

    newFormLayout->addRow(Core::newLabel(tr("Qualifier:"), 1.0, true, newFormWidget),
                          qualifierWidget);

    // Add our term field

    // Create a widget which will contain both our qualifier value widget and a
    // button to look up the qualifier

    QWidget *termWidget = new QWidget(newFormWidget);

    QHBoxLayout *termWidgetLayout = new QHBoxLayout(termWidget);

    termWidgetLayout->setMargin(0);

    termWidget->setLayout(termWidgetLayout);

    // Create our term value widget

    mTermValue = new QLineEdit(termWidget);

    mTermValue->setText(mTerm);
    // Note: we set the text to whatever term was previously being looked up and
    //       this before tracking changes to the term since we don't want to
    //       trigger a call to termChanged(). Indeed, we might come here as a
    //       result of a retranslation so we shouldn't look up for the term and,
    //       instead, we should call updateItemsGui() which we do at the end of
    //       this procedure...

    connect(mTermValue, SIGNAL(textChanged(const QString &)),
            this, SLOT(termChanged(const QString &)));

    // Create our add term button widget

    mAddTermButton = new QPushButton(termWidget);

    mAddTermButton->setEnabled(false);
    mAddTermButton->setIcon(QIcon(":/oxygen/actions/list-add.png"));
    mAddTermButton->setStatusTip(tr("Add the term"));
    mAddTermButton->setToolTip(tr("Add"));
    mAddTermButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);

    connect(mAddTermButton, SIGNAL(clicked()),
            this, SLOT(addTerm()));

    // Add our QComboBox and QPushButton to our cmeta:id widget

    termWidgetLayout->addWidget(mTermValue);
    termWidgetLayout->addWidget(mAddTermButton);

    // Add our term widget to our main layout

    newFormLayout->addRow(Core::newLabel(tr("Term:"), 1.0, true, newFormWidget),
                          termWidget);

    // Reset the tab order from our parent's CellML list's tree view widget
    // Note: ideally, we would take advantage of Qt's signal/slot approach with
    //       the signal being emitted here and the slot being implemented in
    //       mParent, but this wouldn't work here since updateGui() gets called
    //       as part of the creation of this metadata details widget, so...

    setTabOrder(qobject_cast<QWidget *>(mParent->cellmlList()->treeViewWidget()),
                mQualifierValue);
    setTabOrder(mQualifierValue, mLookupQualifierButton);
    setTabOrder(mLookupQualifierButton, mTermValue);
    setTabOrder(mTermValue, mAddTermButton);

    // Create a stacked widget (within a scroll area, so that only the items get
    // scrolled, not the whole metadata edit details widget) which will contain
    // a grid with the results of our terms lookup

    QScrollArea *newItemsScrollArea = new QScrollArea(newMainWidget);

    newItemsScrollArea->setFrameShape(QFrame::NoFrame);
    newItemsScrollArea->setWidgetResizable(true);

    // Add our 'internal' widgets to our new main widget

    newMainLayout->addWidget(newFormWidget);
    newMainLayout->addWidget(new Core::BorderedWidget(newItemsScrollArea,
                                                      true, false, false, false));

    // Keep track of the position of our items vertical scroll bar
    // Note: this is required to make sure that the position doesn't get reset
    //       as a result of retranslating the GUI...

    connect(newItemsScrollArea->verticalScrollBar(), SIGNAL(sliderMoved(int)),
            this, SLOT(trackItemsVerticalScrollBarPosition(const int &)));

    // Add our new widget to our stacked widget

    mWidget->addWidget(newMainWidget);

    // Remove the contents of our old form layout

    if (mFormWidget)
        for (int i = 0, iMax = mFormLayout->count(); i < iMax; ++i) {
            QLayoutItem *item = mFormLayout->takeAt(0);

            delete item->widget();
            delete item;
        }

    // Reset the widget of our old items scroll area and stop tracking the
    // position of its vertical scroll bar
    // Note: the resetting this will automatically delete our old grid widget...

    if (mItemsScrollArea) {
        mItemsScrollArea->setWidget(0);

        disconnect(mItemsScrollArea->verticalScrollBar(), SIGNAL(sliderMoved(int)),
                   this, SLOT(trackItemsVerticalScrollBarPosition(const int &)));
    }

    // Get rid of our old main widget and layout (and its contents)

    if (mMainWidget) {
        mWidget->removeWidget(mMainWidget);

        for (int i = 0, iMax = mMainLayout->count(); i < iMax; ++i) {
            QLayoutItem *item = mMainLayout->takeAt(0);

            delete item->widget();
            delete item;
        }

        delete mMainWidget;
    }

    // Keep track of our new main widgets and layouts

    mMainWidget = newMainWidget;
    mMainLayout = newMainLayout;

    mFormWidget = newFormWidget;
    mFormLayout = newFormLayout;

    mItemsScrollArea = newItemsScrollArea;

    mGridWidget = 0;   // Note: this will be set by our
    mGridLayout = 0;   //       other updateGui() function...

    // Allow ourselves to be updated again

    setUpdatesEnabled(true);

    // Update our items GUI

    updateItemsGui(pItems, pErrorMsg, pLookupTerm);

    // Request for something to be looked up, if needed

    if (mLookupInformation)
        // Look up an 'old' qualifier, resource or resource id

        genericLookup(mInformation, mType, pRetranslate);

    // Set the position of our vertical scroll bar

    mItemsScrollArea->verticalScrollBar()->setValue(pItemsVerticalScrollBarPosition);
}
Example #17
0
SettingsPageTask::SettingsPageTask( QWidget *parent) :
  QWidget( parent ),
  m_selectedSwitchScheme(0),
  m_distUnit(Distance::getUnit()),
  m_startLineValue(0),
  m_startRingValue(0),
  m_startSectorInnerRadiusValue(0),
  m_startSectorOuterRadiusValue(0),
  m_startSectorAngleValue(0),
  m_finishLineValue(0),
  m_finishRingValue(0),
  m_finishSectorInnerRadiusValue(0),
  m_finishSectorOuterRadiusValue(0),
  m_finishSectorAngleValue(0),
  m_obsCircleRadiusValue(0),
  m_obsSectorInnerRadiusValue(0),
  m_obsSectorOuterRadiusValue(0),
  m_obsSectorAngleValue(0)
{
  setObjectName("SettingsPageTask");
  setWindowFlags( Qt::Tool );
  setWindowModality( Qt::WindowModal );
  setAttribute(Qt::WA_DeleteOnClose);
  setWindowTitle( tr("Settings - Task") );

  if( parent )
    {
      resize( parent->size() );
    }

  // Layout used by scroll area
  QHBoxLayout *sal = new QHBoxLayout;

  // new widget used as container for the dialog layout.
  QWidget* sw = new QWidget;

  // Scroll area
  QScrollArea* sa = new QScrollArea;
  sa->setWidgetResizable( true );
  sa->setFrameStyle( QFrame::NoFrame );
  sa->setWidget( sw );

#ifdef ANDROID
  QScrollBar* lvsb = sa->verticalScrollBar();
  lvsb->setStyleSheet( Layout::getCbSbStyle() );
#endif

#ifdef QSCROLLER
  QScroller::grabGesture( sa->viewport(), QScroller::LeftMouseButtonGesture );
#endif

#ifdef QTSCROLLER
  QtScroller::grabGesture( sa->viewport(), QtScroller::LeftMouseButtonGesture );
#endif

  // Add scroll area to its own layout
  sal->addWidget( sa );

  QHBoxLayout *contentLayout = new QHBoxLayout(this);

  // Pass scroll area layout to the content layout.
  contentLayout->addLayout( sal );

  GeneralConfig *conf = GeneralConfig::instance();
  int row = 0;

  QGridLayout *topLayout = new QGridLayout(sw);
  //contentLayout->addLayout(topLayout);

  topLayout->setMargin(10);
  topLayout->setSpacing(20);
  topLayout->setColumnStretch( 3, 5 );

  //---------------------------------------------------------------
  QGroupBox *ssBox = new QGroupBox( tr("Switch Scheme"), this );
  topLayout->addWidget( ssBox, row, 0 );

  ntScheme = new QButtonGroup(this);
  QRadioButton* nearest  = new QRadioButton( tr("Minimum"), this );
  QRadioButton* touched  = new QRadioButton( tr("Touched"), this );

  ntScheme->addButton( nearest, 0 );
  ntScheme->addButton( touched, 1 );

  m_reportSwitch = new QCheckBox( tr("Report"), this );

  QVBoxLayout* vbox = new QVBoxLayout;
  vbox->addWidget( nearest );
  vbox->addWidget( touched );
  vbox->addWidget( m_reportSwitch );
  vbox->addStretch(1);
  ssBox->setLayout(vbox);

  nearest->setEnabled(true);
  touched->setEnabled(true);
  touched->setChecked(true);

  // set active button as selected
  m_selectedSwitchScheme = (int) conf->getActiveTaskSwitchScheme();

  if( ntScheme->button(m_selectedSwitchScheme) )
    {
      ntScheme->button(m_selectedSwitchScheme)->setChecked(true);
    }

  connect( ntScheme, SIGNAL(buttonClicked(int)),
           this, SLOT(slot_buttonPressedNT(int)) );

  //--------------------------------------------------------------
  // as next shape group is added
  QGroupBox* shapeGroup = new QGroupBox( tr("Shape"), this );
  topLayout->addWidget( shapeGroup, row, 1 );

  QGridLayout *gBox = new QGridLayout;
  shapeGroup->setLayout(gBox);

  m_drawShape = new QCheckBox( tr("Draw"), this );
  gBox->addWidget(m_drawShape, 0, 0 );
  m_fillShape = new QCheckBox( tr("Fill"), this );
  gBox->addWidget(m_fillShape, 1, 0 );
  gBox->setColumnStretch( 2, 5 );

  connect( m_fillShape, SIGNAL(stateChanged(int)),
           SLOT(slot_fillShapeStateChanged(int)) );

  m_transShape = new NumberEditor( this );
  m_transShape->setDecimalVisible( false );
  m_transShape->setPmVisible( false );
  m_transShape->setMaxLength(3);
  m_transShape->setSuffix( " %" );
  m_transShape->setRange( 0, 100 );
  m_transShape->setTip(tr("Opacity ") + "0...100");
  m_transShape->setValue( 0 );
  QRegExpValidator* eValidator = new QRegExpValidator( QRegExp( "(0|[1-9][0-9]{0,2})" ), this );
  m_transShape->setValidator( eValidator );

  // Sets a minimum width for the widget
  int mw1 = QFontMetrics(font()).width("100 %") + 10;
  m_transShape->setMinimumWidth( mw1 );
  gBox->addWidget(m_transShape, 1, 1 );

  m_drawShape->setChecked( conf->getTaskDrawShape() );
  m_fillShape->setChecked( conf->getTaskFillShape() );

  //--------------------------------------------------------------
  // as next auto zoom group is added
  QGroupBox* zoomGroup = new QGroupBox( tr("Zoom"), this );
  topLayout->addWidget( zoomGroup, row, 2 );

  QVBoxLayout *zBox = new QVBoxLayout;
  zoomGroup->setLayout(zBox);

  m_autoZoom = new QCheckBox( tr("Auto"), this );
  zBox->addWidget(m_autoZoom);
  zBox->addStretch(10);

  m_autoZoom->setChecked( conf->getTaskPointAutoZoom() );

#ifdef ANDROID
  topLayout->setRowMinimumHeight( ++row, 30 );
#endif

  row++;

  //--------------------------------------------------------------
  // as next start group is added
  QGroupBox* startGroup1 = new QGroupBox( tr("Start"), this );
  topLayout->addWidget( startGroup1, row, 0 );
  QFormLayout *formLayout = new QFormLayout;
  startGroup1->setLayout(formLayout);

  m_startLine = createDNE( this );
  m_startLine->setTip(tr("Line Length"));
  formLayout->addRow(tr("Line:"), m_startLine);

  m_startRing = createDNE( this );
  m_startRing->setTip(tr("Circle Radius"));
  formLayout->addRow(tr("Circle:"), m_startRing);

  //--------------------------------------------------------------
  // as next inner sector group is added
  QGroupBox* startGroup2 = new QGroupBox( tr("Sectors"), this );
  topLayout->addWidget( startGroup2, row, 1 );
  formLayout = new QFormLayout;
  startGroup2->setLayout(formLayout);

  m_startSectorInnerRadius = createDNE( this );
  m_startSectorInnerRadius->setTip(tr("Inner Radius"));
  formLayout->addRow(tr("Radius 1:"), m_startSectorInnerRadius);

  m_startSectorOuterRadius = createDNE( this );
  m_startSectorOuterRadius->setTip(tr("Outer Radius"));
  formLayout->addRow(tr("Radius 2:"), m_startSectorOuterRadius);

  m_startSectorAngle = createNE( this );
  m_startSectorAngle->setTip(tr("Angle 1...360"));

  formLayout->addRow(tr("Angle:"), m_startSectorAngle);

  //--------------------------------------------------------------
  // as next inner scheme group is added
  QGroupBox* startGroup3 = new QGroupBox( tr("Scheme"), this );
  topLayout->addWidget( startGroup3, row, 2 );
  formLayout = new QFormLayout;
  startGroup3->setLayout(formLayout);

  QRadioButton* circle  = new QRadioButton( tr("Circle"), this );
  QRadioButton* sector  = new QRadioButton( tr("Sector"), this );
  QRadioButton* keyhole = new QRadioButton( tr("Keyhole"), this );
  QRadioButton* line    = new QRadioButton( tr("Line"), this );

  startScheme = new QButtonGroup(this);
  startScheme->addButton( circle, GeneralConfig::Circle );
  startScheme->addButton( sector, GeneralConfig::Sector );
  startScheme->addButton( keyhole, GeneralConfig::Keyhole );
  startScheme->addButton( line, GeneralConfig::Line );

  formLayout->addWidget( circle );
  formLayout->addWidget( sector );
  formLayout->addWidget( keyhole );
  formLayout->addWidget( line );

  circle->setEnabled(true);
  circle->setChecked(false);
  sector->setEnabled(true);
  sector->setChecked(false);
  keyhole->setEnabled(true);
  keyhole->setChecked(false);
  line->setEnabled(true);
  line->setChecked(false);

  // set active button as selected
  m_selectedStartScheme = (int) conf->getActiveTaskStartScheme();

  if( startScheme->button(m_selectedStartScheme) )
    {
      startScheme->button(m_selectedStartScheme)->setChecked(true);
    }

#ifdef ANDROID
  topLayout->setRowMinimumHeight( ++row, 30 );
#endif

  row++;

  //--------------------------------------------------------------
  // as next finish group is added
  QGroupBox* finishGroup1 = new QGroupBox( tr("Finish"), this );
  topLayout->addWidget( finishGroup1, row, 0 );
  formLayout = new QFormLayout;
  finishGroup1->setLayout(formLayout);

  m_finishLine = createDNE( this );
  m_finishLine->setTip(tr("Line Length"));
  formLayout->addRow(tr("Line:"), m_finishLine);

  m_finishRing = createDNE( this );
  m_finishRing->setTip(tr("Circle Radius"));
  formLayout->addRow(tr("Circle"), m_finishRing);

  //--------------------------------------------------------------
  // as next inner sector group is added
  QGroupBox* finishGroup2 = new QGroupBox( tr("Sectors"), this );
  topLayout->addWidget( finishGroup2, row, 1 );
  formLayout = new QFormLayout;
  finishGroup2->setLayout(formLayout);

  m_finishSectorInnerRadius = createDNE( this );
  m_finishSectorInnerRadius->setTip(tr("Inner Radius"));
  formLayout->addRow(tr("Radius 1:"), m_finishSectorInnerRadius);

  m_finishSectorOuterRadius = createDNE( this );
  m_finishSectorOuterRadius->setTip(tr("Outer Radius"));
  formLayout->addRow(tr("Radius 2:"), m_finishSectorOuterRadius);

  m_finishSectorAngle = createNE( this );
  m_finishSectorAngle->setTip(tr("Angle 1...360"));
  formLayout->addRow(tr("Angle:"), m_finishSectorAngle);

  //--------------------------------------------------------------
  // as next inner scheme group is added
  QGroupBox* finishGroup3 = new QGroupBox( tr("Scheme"), this );
  topLayout->addWidget( finishGroup3, row, 2 );
  formLayout = new QFormLayout;
  finishGroup3->setLayout(formLayout);

  circle  = new QRadioButton( tr("Circle"), this );
  sector  = new QRadioButton( tr("Sector"), this );
  keyhole = new QRadioButton( tr("Keyhole"), this );
  line    = new QRadioButton( tr("Line"), this );

  finishScheme = new QButtonGroup(this);
  finishScheme->addButton( circle, GeneralConfig::Circle );
  finishScheme->addButton( sector, GeneralConfig::Sector );
  finishScheme->addButton( keyhole, GeneralConfig::Keyhole );
  finishScheme->addButton( line, GeneralConfig::Line );

  formLayout->addWidget( circle );
  formLayout->addWidget( sector );
  formLayout->addWidget( keyhole );
  formLayout->addWidget( line );

  circle->setEnabled(true);
  circle->setChecked(false);
  sector->setEnabled(true);
  sector->setChecked(false);
  keyhole->setEnabled(true);
  keyhole->setChecked(false);
  line->setEnabled(true);
  line->setChecked(false);

  // set active button as selected
  m_selectedFinishScheme = (int) conf->getActiveTaskFinishScheme();

  if( finishScheme->button(m_selectedFinishScheme) )
    {
      finishScheme->button(m_selectedFinishScheme)->setChecked(true);
    }

#ifdef ANDROID
  topLayout->setRowMinimumHeight( ++row, 30 );
#endif

  row++;

  //--------------------------------------------------------------
  // as next observation zone is added
  QGroupBox* obZoneGroup1 = new QGroupBox( tr("Observation"), this );
  topLayout->addWidget( obZoneGroup1, row, 0 );
  formLayout = new QFormLayout;
  obZoneGroup1->setLayout(formLayout);

  m_obsCircleRadius = createDNE( this );
  m_obsCircleRadius->setTip(tr("Circle Radius"));
  formLayout->addRow(tr("Circle:"), m_obsCircleRadius);

  //--------------------------------------------------------------
  // as next inner sector group is added
  QGroupBox* obZoneGroup2 = new QGroupBox( tr("Sectors"), this );
  topLayout->addWidget( obZoneGroup2, row, 1 );
  formLayout = new QFormLayout;
  obZoneGroup2->setLayout(formLayout);

  m_obsSectorInnerRadius = createDNE( this );
  m_obsSectorInnerRadius->setTip(tr("Inner Radius"));
  formLayout->addRow(tr("Radius 1:"), m_obsSectorInnerRadius);

  m_obsSectorOuterRadius = createDNE( this );
  m_obsSectorOuterRadius->setTip(tr("Outer Radius"));
  formLayout->addRow(tr("Radius 2:"), m_obsSectorOuterRadius);

  m_obsSectorAngle = createNE( this );
  m_obsSectorAngle->setTip(tr("Angle 1...360"));
  formLayout->addRow(tr("Angle:"), m_obsSectorAngle);

  //--------------------------------------------------------------
  // as next inner observer scheme group is added
  QGroupBox* obZoneGroup3 = new QGroupBox( tr("Scheme"), this );
  topLayout->addWidget( obZoneGroup3, row, 2 );
  formLayout = new QFormLayout;
  obZoneGroup3->setLayout(formLayout);

  circle  = new QRadioButton( tr("Circle"), this );
  sector  = new QRadioButton( tr("Sector"), this );
  keyhole = new QRadioButton( tr("Keyhole"), this );
  // no line for observer area

  obsScheme = new QButtonGroup(this);
  obsScheme->addButton( circle, GeneralConfig::Circle );
  obsScheme->addButton( sector, GeneralConfig::Sector );
  obsScheme->addButton( keyhole, GeneralConfig::Keyhole );

  formLayout->addWidget( circle );
  formLayout->addWidget( sector );
  formLayout->addWidget( keyhole );

  circle->setEnabled(true);
  circle->setChecked(false);
  sector->setEnabled(true);
  sector->setChecked(false);
  keyhole->setEnabled(true);
  keyhole->setChecked(false);

  // set active button as selected
  m_selectedObsScheme = (int) conf->getActiveTaskObsScheme();

  if( obsScheme->button(m_selectedObsScheme) )
    {
      obsScheme->button(m_selectedObsScheme)->setChecked(true);
    }

  //--------------------------------------------------------------
  // Connect sector check controls.
  connect( m_startSectorOuterRadius, SIGNAL(numberEdited(const QString&)),
           this, SLOT(slot_outerSectorStartChanged(const QString&)) );
  connect( m_finishSectorOuterRadius, SIGNAL(numberEdited(const QString&)),
           this, SLOT(slot_outerSectorFinishChanged(const QString&)) );
  connect( m_obsSectorOuterRadius, SIGNAL(numberEdited(const QString&)),
           this, SLOT(slot_outerSectorObsChanged(const QString&)) );
  connect( startScheme, SIGNAL(buttonClicked(int)), this, SLOT(slot_buttonPressedSS(int)) );
  connect( finishScheme, SIGNAL(buttonClicked(int)), this, SLOT(slot_buttonPressedFS(int)) );
  connect( obsScheme, SIGNAL(buttonClicked(int)), this, SLOT(slot_buttonPressedOS(int)) );

  QPushButton *cancel = new QPushButton(this);
  cancel->setIcon(QIcon(GeneralConfig::instance()->loadPixmap("cancel.png")));
  cancel->setIconSize(QSize(Layout::getButtonSize(12), Layout::getButtonSize(12)));
  cancel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::QSizePolicy::Preferred);

  QPushButton *ok = new QPushButton(this);
  ok->setIcon(QIcon(GeneralConfig::instance()->loadPixmap("ok.png")));
  ok->setIconSize(QSize(Layout::getButtonSize(12), Layout::getButtonSize(12)));
  ok->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::QSizePolicy::Preferred);

  QLabel *titlePix = new QLabel(this);
  titlePix->setAlignment( Qt::AlignCenter );
  titlePix->setPixmap(GeneralConfig::instance()->loadPixmap("setup.png"));

  connect(ok, SIGNAL(pressed()), this, SLOT(slotAccept()));
  connect(cancel, SIGNAL(pressed()), this, SLOT(slotReject()));

  QVBoxLayout *buttonBox = new QVBoxLayout;
  buttonBox->setSpacing(0);
  buttonBox->addStretch(2);
  buttonBox->addWidget(cancel, 1);
  buttonBox->addSpacing(30);
  buttonBox->addWidget(ok, 1);
  buttonBox->addStretch(2);
  buttonBox->addWidget(titlePix);
  contentLayout->addLayout(buttonBox);

  load();
}
Example #18
0
CPUWidget::CPUWidget(QWidget* parent) : QWidget(parent), ui(new Ui::CPUWidget)
{
    ui->setupUi(this);
    setDefaultDisposition();

    mDisas = new CPUDisassembly(0);
    mSideBar = new CPUSideBar(mDisas);
    connect(mDisas, SIGNAL(tableOffsetChanged(int_t)), mSideBar, SLOT(changeTopmostAddress(int_t)));
    connect(mDisas, SIGNAL(viewableRows(int)), mSideBar, SLOT(setViewableRows(int)));
    connect(mDisas, SIGNAL(repainted()), mSideBar, SLOT(repaint()));
    connect(mDisas, SIGNAL(selectionChanged(int_t)), mSideBar, SLOT(setSelection(int_t)));
    connect(Bridge::getBridge(), SIGNAL(dbgStateChanged(DBGSTATE)), mSideBar, SLOT(debugStateChangedSlot(DBGSTATE)));
    connect(Bridge::getBridge(), SIGNAL(updateSideBar()), mSideBar, SLOT(repaint()));

    QSplitter* splitter = new QSplitter(this);
    splitter->addWidget(mSideBar);
    splitter->addWidget(mDisas);
    splitter->setChildrenCollapsible(false);
    splitter->setHandleWidth(1);

    ui->mTopLeftUpperFrameLayout->addWidget(splitter);

    mInfo = new CPUInfoBox();
    ui->mTopLeftLowerFrameLayout->addWidget(mInfo);
    int height = mInfo->getHeight();
    ui->mTopLeftLowerFrame->setMinimumHeight(height + 2);
    ui->mTopLeftLowerFrame->setMaximumHeight(height + 2);

    connect(mDisas, SIGNAL(selectionChanged(int_t)), mInfo, SLOT(disasmSelectionChanged(int_t)));

    mGeneralRegs = new RegistersView(0);
    mGeneralRegs->setFixedWidth(1000);
    mGeneralRegs->setFixedHeight(1400);
    mGeneralRegs->ShowFPU(true);

    QScrollArea* scrollArea = new QScrollArea;
    scrollArea->setWidget(mGeneralRegs);

    scrollArea->horizontalScrollBar()->setStyleSheet("QScrollBar:horizontal{border:1px solid grey;background:#f1f1f1;height:10px}QScrollBar::handle:horizontal{background:#aaa;min-width:20px;margin:1px}QScrollBar::add-line:horizontal,QScrollBar::sub-line:horizontal{width:0;height:0}");
    scrollArea->verticalScrollBar()->setStyleSheet("QScrollBar:vertical{border:1px solid grey;background:#f1f1f1;width:10px}QScrollBar::handle:vertical{background:#aaa;min-height:20px;margin:1px}QScrollBar::add-line:vertical,QScrollBar::sub-line:vertical{width:0;height:0}");

    QPushButton* button_changeview = new QPushButton("");

    mGeneralRegs->SetChangeButton(button_changeview);

    button_changeview->setStyleSheet("Text-align:left;padding: 4px;padding-left: 10px;");
    QFont font = QFont("Lucida Console");
    font.setStyleHint(QFont::Monospace);
    font.setPointSize(8);
    button_changeview->setFont(font);
    connect(button_changeview, SIGNAL(clicked()), mGeneralRegs, SLOT(onChangeFPUViewAction()));

    ui->mTopRightFrameLayout->addWidget(button_changeview);

    ui->mTopRightFrameLayout->addWidget(scrollArea);

    mDump = new CPUDump(mDisas, 0); //dump widget
    ui->mBotLeftFrameLayout->addWidget(mDump);

    mStack = new CPUStack(0); //stack widget
    ui->mBotRightFrameLayout->addWidget(mStack);
}
Example #19
0
void tst_QAbstractScrollArea::setScrollBars()
{
    QScrollArea scrollArea;
    scrollArea.resize(300, 300);
    scrollArea.show();

    QPointer<QScrollBar> vbar = scrollArea.verticalScrollBar();
    QPointer<QScrollBar> hbar = scrollArea.horizontalScrollBar();

    // Now set properties on the scroll bars
    scrollArea.verticalScrollBar()->setInvertedAppearance(true);
    scrollArea.verticalScrollBar()->setInvertedControls(true);
    scrollArea.verticalScrollBar()->setTracking(true);
    scrollArea.verticalScrollBar()->setRange(-100, 100);
    scrollArea.verticalScrollBar()->setPageStep(42);
    scrollArea.verticalScrollBar()->setSingleStep(3);
    scrollArea.verticalScrollBar()->setValue(43);
    scrollArea.horizontalScrollBar()->setInvertedAppearance(true);
    scrollArea.horizontalScrollBar()->setInvertedControls(true);
    scrollArea.horizontalScrollBar()->setTracking(true);
    scrollArea.horizontalScrollBar()->setRange(-100, 100);
    scrollArea.horizontalScrollBar()->setPageStep(42);
    scrollArea.horizontalScrollBar()->setSingleStep(3);
    scrollArea.horizontalScrollBar()->setValue(43);

    qApp->processEvents();

    // Then replace the scroll bars
    scrollArea.setVerticalScrollBar(new QScrollBar);
    scrollArea.setHorizontalScrollBar(new QScrollBar);

    // Check that the old ones were deleted
    QVERIFY(!vbar);
    QVERIFY(!hbar);

    qApp->processEvents();

    // Check that all properties have been populated
    QVERIFY(scrollArea.verticalScrollBar()->invertedAppearance());
    QVERIFY(scrollArea.verticalScrollBar()->invertedControls());
    QVERIFY(scrollArea.verticalScrollBar()->hasTracking());
    QVERIFY(scrollArea.verticalScrollBar()->isVisible());
    QCOMPARE(scrollArea.verticalScrollBar()->minimum(), -100);
    QCOMPARE(scrollArea.verticalScrollBar()->maximum(), 100);
    QCOMPARE(scrollArea.verticalScrollBar()->pageStep(), 42);
    QCOMPARE(scrollArea.verticalScrollBar()->singleStep(), 3);
    QCOMPARE(scrollArea.verticalScrollBar()->value(), 43);
    QVERIFY(scrollArea.horizontalScrollBar()->invertedAppearance());
    QVERIFY(scrollArea.horizontalScrollBar()->invertedControls());
    QVERIFY(scrollArea.horizontalScrollBar()->hasTracking());
    QVERIFY(scrollArea.horizontalScrollBar()->isVisible());
    QCOMPARE(scrollArea.horizontalScrollBar()->minimum(), -100);
    QCOMPARE(scrollArea.horizontalScrollBar()->maximum(), 100);
    QCOMPARE(scrollArea.horizontalScrollBar()->pageStep(), 42);
    QCOMPARE(scrollArea.horizontalScrollBar()->singleStep(), 3);
    QCOMPARE(scrollArea.horizontalScrollBar()->value(), 43);
}
AppStoreRankingWidget::AppStoreRankingWidget(QWidget *parent)
{
	QString paths[] =
	{
		Webbox::Utility::PathUtil::GetCurrentExePath() +"/Skin/img/dota2.png",
		Webbox::Utility::PathUtil::GetCurrentExePath() +"/Skin/img/messages.png",
		Webbox::Utility::PathUtil::GetCurrentExePath() +"/Skin/img/safari.png",
		Webbox::Utility::PathUtil::GetCurrentExePath() +"/Skin/img/ibooks.png",
		Webbox::Utility::PathUtil::GetCurrentExePath() +"/Skin/img/launchpad.png",
		Webbox::Utility::PathUtil::GetCurrentExePath() +"/Skin/img/maps.png",
		Webbox::Utility::PathUtil::GetCurrentExePath() +"/Skin/img/facetime.png",
		Webbox::Utility::PathUtil::GetCurrentExePath() +"/Skin/img/gamecenter.png"
	};


	QColor colors[] =
	{
		QColor(255, 0, 0),
		QColor(0, 255, 0),
		QColor(0, 0, 255),
		QColor(100, 100, 100),
		QColor(255, 0, 255),
		QColor(0, 255, 255),
		QColor(0, 100, 230),
		QColor(255, 100, 0, 100),
	};

	contentWidget = new RankingWidget();

	for (int i = 0; i < 8; ++i)
	{
		RankingLabel *label = new RankingLabel(700, 100, 102, paths[i], QString::fromWCharArray(L"Office 2015"), QString::fromWCharArray(L"Windows 7+"), QString::fromWCharArray(L"Æƽâ"));
		label->setColor(colors[7]);
		contentWidget->addItem(label);
	}

	QScrollArea *scrollArea = new QScrollArea;
	scrollArea->setGeometry(contentWidget->geometry());
	scrollArea->setWidget(contentWidget); // MainWidget is the container widget i.e. the window itself
	scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);

	/*scrollArea->viewport()->setAutoFillBackground(true);
	scrollArea->setStyleSheet("background-color:transparent;");*/

	scrollArea->verticalScrollBar()->setStyleSheet("QScrollBar{background:transparent; width: 10px;}"
		"QScrollBar::handle{background:lightgray; border:2px solid transparent; border-radius:5px;}"
		"QScrollBar::handle:hover{background:gray;}"
		"QScrollBar::sub-line{background:transparent;}"
		"QScrollBar::add-line{background:transparent;}");
 
	NavControlWidget *navWidget = new NavControlWidget();
 
	QHBoxLayout *bot_layout = new QHBoxLayout();
	bot_layout->addStretch(); 
	bot_layout->addWidget(navWidget);
	bot_layout->addStretch();

	QVBoxLayout *mainLayout = new QVBoxLayout(); 
	mainLayout->addWidget(scrollArea);
	mainLayout->addLayout(bot_layout);

	setLayout(mainLayout);
}