本文整理汇总了C++中QScrollBar::setStyleSheet方法的典型用法代码示例。如果您正苦于以下问题:C++ QScrollBar::setStyleSheet方法的具体用法?C++ QScrollBar::setStyleSheet怎么用?C++ QScrollBar::setStyleSheet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QScrollBar
的用法示例。
在下文中一共展示了QScrollBar::setStyleSheet方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: slot_scrollerBoxToggled
void FlarmAliasList::slot_scrollerBoxToggled( int state )
{
if( m_enableScroller == 0 )
{
return;
}
if( state == Qt::Checked )
{
#ifdef QSCROLLER
list->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
QScroller::grabGesture( list->viewport(), QScroller::LeftMouseButtonGesture );
#endif
#ifdef QTSCROLLER
list->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
QtScroller::grabGesture( list->viewport(), QtScroller::LeftMouseButtonGesture );
#endif
#ifdef ANDROID
// Reset scrollbar style sheet to default.
QScrollBar* lvsb = list->verticalScrollBar();
lvsb->setStyleSheet( "" );
#endif
}
else if( state == Qt::Unchecked)
{
#ifdef QSCROLLER
QScroller::ungrabGesture( list->viewport() );
#endif
#ifdef QTSCROLLER
QtScroller::ungrabGesture( list->viewport() );
#endif
#ifdef ANDROID
// Make the vertical scrollbar bigger for Android
QScrollBar* lvsb = list->verticalScrollBar();
lvsb->setStyleSheet( Layout::getCbSbStyle() );
#endif
}
}
示例2: switchToServer
void StartScene::switchToServer(Server *server) {
#ifdef AUDIO_SUPPORT
Audio::quit();
#endif
// performs leaving animation
QPropertyAnimation *logo_shift = new QPropertyAnimation(logo, "pos");
logo_shift->setEndValue(QPointF(Config.Rect.center().rx() - 200, Config.Rect.center().ry() - 175));
QPropertyAnimation *logo_shrink = new QPropertyAnimation(logo, "scale");
logo_shrink->setEndValue(0.5);
QParallelAnimationGroup *group = new QParallelAnimationGroup(this);
group->addAnimation(logo_shift);
group->addAnimation(logo_shrink);
group->start(QAbstractAnimation::DeleteWhenStopped);
foreach (Button *button, buttons)
delete button;
buttons.clear();
server_log = new QTextEdit();
server_log->setReadOnly(true);
server_log->resize(700, 420);
server_log->move(-400, -180);
server_log->setFrameShape(QFrame::NoFrame);
#ifdef Q_OS_LINUX
server_log->setFont(QFont("DroidSansFallback", 12));
#else
server_log->setFont(QFont("Verdana", 12));
#endif
server_log->setTextColor(Config.TextEditColor);
setServerLogBackground();
addWidget(server_log);
QScrollBar *bar = server_log->verticalScrollBar();
QFile file("qss/scroll.qss");
if (file.open(QIODevice::ReadOnly)) {
QTextStream stream(&file);
bar->setStyleSheet(stream.readAll());
}
printServerInfo();
connect(server, SIGNAL(server_message(QString)), server_log, SLOT(append(QString)));
update();
}
示例3: switchToServer
void StartScene::switchToServer(Server *server) {
// performs leaving animation
QPropertyAnimation *logo_shift = new QPropertyAnimation(logo, "pos", this);
QPropertyAnimation *logo_shrink = new QPropertyAnimation(logo, "scale", this);
logo_shrink->setEndValue(0.5);
QParallelAnimationGroup *group = new QParallelAnimationGroup(this);
group->addAnimation(logo_shift);
group->addAnimation(logo_shrink);
group->start(QAbstractAnimation::DeleteWhenStopped);
foreach (Button *button, buttons)
delete button;
buttons.clear();
server_log = new QTextEdit();
server_log->setReadOnly(true);
server_log->resize(700, 420);
QRectF startSceneRect = sceneRect();
server_log->move(startSceneRect.width() / 2 - server_log->width() / 2,
startSceneRect.height() / 2 - server_log->height() / 2 + logo->boundingRect().height() / 4);
server_log->setFrameShape(QFrame::NoFrame);
server_log->setFont(QFont("Verdana", 12));
server_log->setTextColor(Config.TextEditColor);
setServerLogBackground();
QGraphicsProxyWidget *widget = addWidget(server_log);
widget->setParent(this);
QScrollBar *logBoxVScrollBar = server_log->verticalScrollBar();
if (NULL != logBoxVScrollBar) {
logBoxVScrollBar->setObjectName("sgsVSB");
logBoxVScrollBar->setStyleSheet(Settings::getQSSFileContent());
}
printServerInfo();
connect(server, SIGNAL(server_message(QString)), server_log, SLOT(append(QString)));
update();
}
示例4: pixmap
//.........这里部分代码省略.........
// create elevation color bar as image
elevationImage = new ElevationColorImage( &terrainColor[0], this );
topLayout->addWidget( elevationImage );
// all editor widgets will be put into a group box to get a better view
QGroupBox *editBox = new QGroupBox( tr("Color Selection"), this );
// put group box in an extra VBox layout to center it vertically
QVBoxLayout *editAll = new QVBoxLayout;
editAll->addStretch( 10 );
editAll->addWidget( editBox );
editAll->addStretch( 10 );
topLayout->addLayout( editAll );
// put all edit widgets (combo box and buttons) in a separate VBox layout
QVBoxLayout *editLayout = new QVBoxLayout;
editLayout->setSpacing( editLayout->spacing() * Layout::getIntScaledDensity() );
QLabel *label = new QLabel( tr("Terrain Level") );
editLayout->addWidget( label );
//--------------------------------------------------------------------------
// The users altitude unit (meters/feed) must be considered during
// elevation display in the combo box.
QString unit;
elevationBox = new QComboBox( this );
#ifdef ANDROID
QAbstractItemView* listView = elevationBox->view();
QScrollBar* lvsb = listView->verticalScrollBar();
lvsb->setStyleSheet( Layout::getCbSbStyle() );
#endif
#ifdef QSCROLLER
elevationBox->view()->setVerticalScrollMode( QAbstractItemView::ScrollPerPixel );
QScroller::grabGesture( elevationBox->view()->viewport(), QScroller::LeftMouseButtonGesture );
#endif
#ifdef QTSCROLLER
elevationBox->view()->setVerticalScrollMode( QAbstractItemView::ScrollPerPixel );
QtScroller::grabGesture( elevationBox->view()->viewport(), QtScroller::LeftMouseButtonGesture );
#endif
if( Altitude::getUnit() == Altitude::meters )
{
// use unit meter
unit = "m";
for( int i = SIZEOF_TERRAIN_COLORS-1; i > 1; i-- )
{
pixmap.fill( terrainColor[i] );
elevationBox->addItem( QIcon( pixmap ), QString(altitudes[i]) + unit );
}
}
else
{
// use unit feed
unit = "ft";
for( int i = SIZEOF_TERRAIN_COLORS-1; i > 1; i-- )
{
int altFeed = static_cast<int>(QString(altitudes[i]).toDouble() * 3.28095);
pixmap.fill( terrainColor[i] );
示例5: QWidget
AirfieldSelectionList::AirfieldSelectionList( QWidget *parent ) :
QWidget(parent)
{
setObjectName( "AirfieldSelectionList" );
setWindowTitle(tr("Airfield Selection"));
setWindowFlags( Qt::Tool );
setWindowModality( Qt::WindowModal );
setAttribute(Qt::WA_DeleteOnClose);
if( parent )
{
resize( parent->size() );
}
QHBoxLayout* mainLayout = new QHBoxLayout( this );
m_airfieldTreeWidget = new QTreeWidget( this );
mainLayout->addWidget( m_airfieldTreeWidget );
m_airfieldTreeWidget->setRootIsDecorated( false );
m_airfieldTreeWidget->setItemsExpandable( false );
m_airfieldTreeWidget->setSortingEnabled( true );
m_airfieldTreeWidget->setSelectionMode( QAbstractItemView::SingleSelection );
m_airfieldTreeWidget->setSelectionBehavior( QAbstractItemView::SelectRows );
m_airfieldTreeWidget->setAlternatingRowColors(true);
m_airfieldTreeWidget->setColumnCount( 1 );
m_airfieldTreeWidget->setFocusPolicy( Qt::StrongFocus );
m_airfieldTreeWidget->setUniformRowHeights(true);
m_airfieldTreeWidget->setHeaderLabel( tr( "Airfields" ) );
connect( m_airfieldTreeWidget, SIGNAL(itemSelectionChanged()),
SLOT(slotItemSelectionChanged()) );
// Set additional space per row
RowDelegate* rowDelegate = new RowDelegate( m_airfieldTreeWidget, 10 );
m_airfieldTreeWidget->setItemDelegate( rowDelegate );
QTreeWidgetItem* headerItem = m_airfieldTreeWidget->headerItem();
headerItem->setTextAlignment( 0, Qt::AlignCenter );
m_airfieldTreeWidget->setVerticalScrollMode( QAbstractItemView::ScrollPerPixel );
m_airfieldTreeWidget->setHorizontalScrollMode( QAbstractItemView::ScrollPerPixel );
#ifdef ANDROID
QScrollBar* lvsb = m_airfieldTreeWidget->verticalScrollBar();
lvsb->setStyleSheet( Layout::getCbSbStyle() );
#endif
#ifdef QSCROLLER
QScroller::grabGesture(m_airfieldTreeWidget->viewport(), QScroller::LeftMouseButtonGesture);
#endif
#ifdef QTSCROLLER
QtScroller::grabGesture(m_airfieldTreeWidget->viewport(), QtScroller::LeftMouseButtonGesture);
#endif
QVBoxLayout* groupLayout = new QVBoxLayout;
m_groupBox = new QGroupBox( tr("Search Airfield"));
m_groupBox->setLayout( groupLayout );
mainLayout->addWidget( m_groupBox );
m_searchInput = new QLineEdit;
groupLayout->addWidget( m_searchInput );
Qt::InputMethodHints imh = (m_searchInput->inputMethodHints() | Qt::ImhNoPredictiveText);
m_searchInput->setInputMethodHints(imh);
#ifndef ANDROID
m_searchInput->setToolTip( tr("Enter a search string, to navigate to a certain list entry.") );
#endif
connect( m_searchInput, SIGNAL(returnPressed()),
MainWindow::mainWindow(), SLOT(slotCloseSip()) );
connect( m_searchInput, SIGNAL(textEdited(const QString&)),
SLOT(slotTextEdited(const QString&)) );
QHBoxLayout* clearLayout = new QHBoxLayout;
clearLayout->setSpacing(0);
clearLayout->addStretch(5);
QPushButton* clearButton = new QPushButton(tr("Clear"));
#ifndef ANDROID
clearButton->setToolTip( tr("Click Clear to remove the search string.") );
#endif
clearLayout->addWidget( clearButton );
groupLayout->addLayout( clearLayout );
groupLayout->addStretch(5);
connect( clearButton, SIGNAL(clicked()), SLOT(slotClearSearchEntry()));
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);
connect( cancel, SIGNAL(clicked()), SLOT(slotReject()) );
//.........这里部分代码省略.........
示例6: QWidget
PreFlightWidget::PreFlightWidget( QWidget* parent ) :
QWidget(parent)
{
setObjectName("PreFlightWidget");
setWindowTitle(tr("Flight Settings"));
setWindowFlags( Qt::Tool );
setWindowModality( Qt::WindowModal );
setAttribute(Qt::WA_DeleteOnClose);
if( parent )
{
resize( parent->size() );
}
QHBoxLayout *contentLayout = new QHBoxLayout;
setLayout(contentLayout);
m_setupTree = new QTreeWidget( this );
m_setupTree->setRootIsDecorated( false );
m_setupTree->setItemsExpandable( false );
m_setupTree->setSortingEnabled( true );
m_setupTree->setSelectionMode( QAbstractItemView::SingleSelection );
m_setupTree->setSelectionBehavior( QAbstractItemView::SelectRows );
m_setupTree->setAlternatingRowColors(true);
m_setupTree->setColumnCount( 1 );
m_setupTree->setFocusPolicy( Qt::StrongFocus );
m_setupTree->setUniformRowHeights(true);
m_setupTree->setHeaderLabel( tr( FLYING ) );
// Set additional space per row
RowDelegate* rowDelegate = new RowDelegate( m_setupTree, 10 );
m_setupTree->setItemDelegate( rowDelegate );
QTreeWidgetItem* headerItem = m_setupTree->headerItem();
headerItem->setTextAlignment( 0, Qt::AlignCenter );
m_setupTree->setVerticalScrollMode( QAbstractItemView::ScrollPerPixel );
m_setupTree->setHorizontalScrollMode( QAbstractItemView::ScrollPerPixel );
#ifdef ANDROID
QScrollBar* lvsb = m_setupTree->verticalScrollBar();
lvsb->setStyleSheet( Layout::getCbSbStyle() );
#endif
#ifdef QSCROLLER
QScroller::grabGesture(m_setupTree->viewport(), QScroller::LeftMouseButtonGesture);
#endif
#ifdef QTSCROLLER
QtScroller::grabGesture(m_setupTree->viewport(), QtScroller::LeftMouseButtonGesture);
#endif
connect( m_setupTree, SIGNAL(itemClicked( QTreeWidgetItem*, int )),
this, SLOT( slotPageClicked( QTreeWidgetItem*, int )) );
contentLayout->addWidget( m_setupTree, 5 );
QTreeWidgetItem* item = new QTreeWidgetItem;
item->setText( 0, tr(GLIDER) );
item->setData( 0, Qt::UserRole, GLIDER );
m_setupTree->addTopLevelItem( item );
item = new QTreeWidgetItem;
item->setText( 0, tr(TASKS) );
item->setData( 0, Qt::UserRole, TASKS );
m_setupTree->addTopLevelItem( item );
item = new QTreeWidgetItem;
item->setText( 0, tr(WAYPOINTS) );
item->setData( 0, Qt::UserRole, WAYPOINTS );
m_setupTree->addTopLevelItem( item );
item = new QTreeWidgetItem;
item->setText( 0, tr(CHECKLIST) );
item->setData( 0, Qt::UserRole, CHECKLIST );
m_setupTree->addTopLevelItem( item );
item = new QTreeWidgetItem;
item->setText( 0, tr(COMMON) );
item->setData( 0, Qt::UserRole, COMMON );
m_setupTree->addTopLevelItem( item );
item = new QTreeWidgetItem;
item->setText( 0, tr(LOGBOOKS) );
item->setData( 0, Qt::UserRole, LOGBOOKS );
m_setupTree->addTopLevelItem( item );
#ifdef FLARM
item = new QTreeWidgetItem;
item->setText( 0, tr(FLARMIGC) );
item->setData( 0, Qt::UserRole, FLARMIGC );
if( calculator->moving() == false )
{
m_setupTree->addTopLevelItem( item );
}
#endif
#ifdef ANDROID
item = new QTreeWidgetItem;
//.........这里部分代码省略.........
示例7: QWidget
/**
* Constructor
*/
FlarmAliasList::FlarmAliasList( QWidget *parent ) :
QWidget( parent ),
list(0),
m_enableScroller(0)
{
setAttribute( Qt::WA_DeleteOnClose );
QHBoxLayout *topLayout = new QHBoxLayout( this );
topLayout->setSpacing(5);
list = new QTableWidget( 0, 2, this );
list->setSelectionBehavior( QAbstractItemView::SelectRows );
// list->setSelectionMode( QAbstractItemView::SingleSelection );
list->setAlternatingRowColors( true );
list->setVerticalScrollMode( QAbstractItemView::ScrollPerPixel );
list->setHorizontalScrollMode( QAbstractItemView::ScrollPerPixel );
#ifdef ANDROID
QScrollBar* lvsb = list->verticalScrollBar();
lvsb->setStyleSheet( Layout::getCbSbStyle() );
#endif
#ifdef QSCROLLER
QScroller::grabGesture( list->viewport(), QScroller::LeftMouseButtonGesture );
#endif
#ifdef QTSCROLLER
QtScroller::grabGesture( list->viewport(), QtScroller::LeftMouseButtonGesture );
#endif
QString style = "QTableView QTableCornerButton::section { background: gray }";
list->setStyleSheet( style );
QHeaderView *vHeader = list->verticalHeader();
style = "QHeaderView::section { width: 2em }";
vHeader->setStyleSheet( style );
// set new row height from configuration
int afMargin = GeneralConfig::instance()->getListDisplayAFMargin();
rowDelegate = new RowDelegate( list, afMargin );
list->setItemDelegate( rowDelegate );
// hide vertical headers
// QHeaderView *vHeader = list->verticalHeader();
// vHeader->setVisible(false);
QHeaderView* hHeader = list->horizontalHeader();
hHeader->setStretchLastSection( true );
#if QT_VERSION >= 0x050000
hHeader->setSectionsClickable( true );
#else
hHeader->setClickable( true );
#endif
connect( hHeader, SIGNAL(sectionClicked(int)),
this, SLOT(slot_HeaderClicked(int)) );
QTableWidgetItem *item = new QTableWidgetItem( tr(" Flarm ID ") );
list->setHorizontalHeaderItem( 0, item );
item = new QTableWidgetItem( tr(" Alias (15) ") );
list->setHorizontalHeaderItem( 1, item );
connect( list, SIGNAL(cellChanged( int, int )),
this, SLOT(slot_CellChanged( int, int )) );
connect( list, SIGNAL(cellClicked( int, int )),
this, SLOT(slot_CellClicked( int, int )) );
connect( list, SIGNAL(itemSelectionChanged()),
this, SLOT(slot_ItemSelectionChanged()) );
topLayout->addWidget( list, 2 );
QGroupBox* buttonBox = new QGroupBox( this );
int buttonSize = Layout::getButtonSize();
int iconSize = buttonSize - 5;
QPushButton *addButton = new QPushButton;
addButton->setIcon( QIcon( GeneralConfig::instance()->loadPixmap( "add.png" ) ) );
addButton->setIconSize(QSize(iconSize, iconSize));
// addButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::QSizePolicy::Preferred);
addButton->setMinimumSize(buttonSize, buttonSize);
addButton->setMaximumSize(buttonSize, buttonSize);
deleteButton = new QPushButton;
deleteButton->setIcon( QIcon( GeneralConfig::instance()->loadPixmap( "delete.png" ) ) );
deleteButton->setIconSize(QSize(iconSize, iconSize));
// deleteButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::QSizePolicy::Preferred);
deleteButton->setMinimumSize(buttonSize, buttonSize);
deleteButton->setMaximumSize(buttonSize, buttonSize);
deleteButton->setEnabled(false);
#if defined(QSCROLLER) || defined(QTSCROLLER)
m_enableScroller = new QCheckBox("][");
m_enableScroller->setCheckState( Qt::Checked );
//.........这里部分代码省略.........
示例8: QWidget
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 );
//.........这里部分代码省略.........
示例9: QWidget
/**
* Constructor
*/
Logbook::Logbook( QWidget *parent ) :
QWidget( parent ),
m_tableModified(false)
{
setObjectName("Logbook");
setWindowFlags(Qt::Tool);
setWindowTitle( tr("Logbook"));
setWindowModality( Qt::WindowModal );
setAttribute(Qt::WA_DeleteOnClose);
// Resize the window to the same size as the main window has. That will
// completely hide the parent window.
resize( MainWindow::mainWindow()->size() );
QHBoxLayout *topLayout = new QHBoxLayout( this );
topLayout->setSpacing(5);
m_table = new QTableWidget( 0, 8, this );
m_table->setVerticalScrollMode( QAbstractItemView::ScrollPerPixel );
m_table->setHorizontalScrollMode( QAbstractItemView::ScrollPerPixel );
#ifdef ANDROID
QScrollBar* lvsb = m_table->verticalScrollBar();
lvsb->setStyleSheet( Layout::getCbSbStyle() );
#endif
#ifdef QSCROLLER
QScroller::grabGesture( m_table->viewport(), QScroller::LeftMouseButtonGesture );
#endif
#ifdef QTSCROLLER
QtScroller::grabGesture( m_table->viewport(), QtScroller::LeftMouseButtonGesture );
#endif
m_table->setSelectionBehavior( QAbstractItemView::SelectRows );
m_table->setAlternatingRowColors( true );
QHeaderView* hHeader = m_table->horizontalHeader();
// that makes trouble on N810
// hHeader->setStretchLastSection( true );
#if QT_VERSION >= 0x050000
hHeader->setSectionsClickable( true );
#else
hHeader->setClickable( true );
#endif
connect( hHeader, SIGNAL(sectionClicked(int)),
this, SLOT(slot_HeaderClicked(int)) );
setTableHeader();
topLayout->addWidget( m_table, 2 );
QGroupBox* buttonBox = new QGroupBox( this );
int buttonSize = Layout::getButtonSize();
int iconSize = buttonSize - 5;
m_deleteAllButton = new QPushButton;
m_deleteAllButton->setIcon( QIcon( GeneralConfig::instance()->loadPixmap( "clear.png" ) ) );
m_deleteAllButton->setIconSize(QSize(iconSize, iconSize));
m_deleteAllButton->setMinimumSize(buttonSize, buttonSize);
m_deleteAllButton->setMaximumSize(buttonSize, buttonSize);
m_deleteButton = new QPushButton;
m_deleteButton->setIcon( QIcon( GeneralConfig::instance()->loadPixmap( "delete.png" ) ) );
m_deleteButton->setIconSize(QSize(iconSize, iconSize));
m_deleteButton->setMinimumSize(buttonSize, buttonSize);
m_deleteButton->setMaximumSize(buttonSize, buttonSize);
m_deleteButton->setEnabled(false);
m_okButton = new QPushButton;
m_okButton->setIcon(QIcon(GeneralConfig::instance()->loadPixmap("ok.png")));
m_okButton->setIconSize(QSize(iconSize, iconSize));
m_okButton->setMinimumSize(buttonSize, buttonSize);
m_okButton->setMaximumSize(buttonSize, buttonSize);
QPushButton *closeButton = new QPushButton;
closeButton->setIcon(QIcon(GeneralConfig::instance()->loadPixmap("cancel.png")));
closeButton->setIconSize(QSize(iconSize, iconSize));
closeButton->setMinimumSize(buttonSize, buttonSize);
closeButton->setMaximumSize(buttonSize, buttonSize);
connect( m_deleteAllButton, SIGNAL(clicked() ), this, SLOT(slot_DeleteAllRows()) );
connect( m_deleteButton, SIGNAL(clicked() ), this, SLOT(slot_DeleteRows()) );
connect( m_okButton, SIGNAL(clicked() ), this, SLOT(slot_Ok()) );
connect( closeButton, SIGNAL(clicked() ), this, SLOT(slot_Close()) );
// vertical box with operator buttons
QVBoxLayout *vbox = new QVBoxLayout;
vbox->setSpacing(0);
vbox->addWidget( m_deleteAllButton );
vbox->addSpacing(32);
vbox->addWidget( m_deleteButton );
vbox->addStretch(2);
//.........这里部分代码省略.........
示例10: QWidget
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();
//.........这里部分代码省略.........
示例11: QWidget
//.........这里部分代码省略.........
m_edtWater->setDecimalVisible( false );
m_edtWater->setPmVisible( false );
m_edtWater->setMaxLength(4);
m_edtWater->setSuffix(" l");
m_edtWater->setRange( 0, 9999 );
m_edtWater->setValue( 0 );
topLayout->addWidget(m_edtWater, row, 3);
row++;
QHBoxLayout* hbox = new QHBoxLayout;
hbox->addWidget( new QLabel(tr("Ref. weight:"), this) );
m_refWeight = new QLabel;
m_refWeight->setFocusPolicy(Qt::NoFocus);
hbox->addWidget( m_refWeight, 10 );
topLayout->addLayout( hbox, row, 0, 1, 2 );
hbox = new QHBoxLayout;
hbox->addWidget( new QLabel(tr("Wing load:"), this) );
m_wingLoad = new QLabel;
m_wingLoad->setFocusPolicy(Qt::NoFocus);
hbox->addWidget( m_wingLoad, 10 );
topLayout->addLayout( hbox, row, 2, 1, 2 );
row++;
topLayout->setRowMinimumHeight( row, 10 );
row++;
m_gliderList = new GliderListWidget( this, true );
#ifndef ANDROID
m_gliderList->setToolTip(tr("Select a glider to be used"));
#endif
#ifdef ANDROID
QScrollBar* lvsb = m_gliderList->verticalScrollBar();
lvsb->setStyleSheet( Layout::getCbSbStyle() );
#endif
#ifdef QSCROLLER
QScroller::grabGesture(m_gliderList->viewport(), QScroller::LeftMouseButtonGesture);
#endif
#ifdef QTSCROLLER
QtScroller::grabGesture(m_gliderList->viewport(), QtScroller::LeftMouseButtonGesture);
#endif
topLayout->addWidget(m_gliderList, row, 0, 1, 4);
row++;
//---------------------------------------------------------------------
QPushButton* deselect = new QPushButton( tr("Deselect"), this );
#ifndef ANDROID
deselect->setToolTip( tr("Clear glider selection") );
#endif
topLayout->addWidget( deselect, row, 3 );
//---------------------------------------------------------------------
m_gliderList->fillList();
m_gliderList->clearSelection();
m_gliderList->selectItemFromList();
connect(deselect, SIGNAL(clicked()), this, SLOT(slotGliderDeselected()) );
connect(m_gliderList, SIGNAL(itemSelectionChanged()), this, SLOT(slotGliderChanged()));
connect(m_edtLoad, SIGNAL(numberEdited(const QString&)), this, SLOT(slotLoadEdited(const QString&)));
connect(m_edtWater, SIGNAL(numberEdited(const QString&)), this, SLOT(slotWaterEdited(const QString&)));
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( _globalMapConfig->createGlider(315, 1.6) );
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);
}
示例12: QWidget
PreFlightWeatherPage::PreFlightWeatherPage( QWidget *parent ) :
QWidget(parent),
m_downloadManger(0),
m_updateIsRunning(false),
NoMetar(tr("No METAR available")),
NoTaf(tr("No TAF available"))
{
setObjectName("PreFlightWeatherPage");
setWindowTitle(tr("METAR and TAF"));
setWindowFlags( Qt::Tool );
setWindowModality( Qt::WindowModal );
setAttribute(Qt::WA_DeleteOnClose);
if( MainWindow::mainWindow() )
{
// Resize the window to the same size as the main window has. That will
// completely hide the parent window.
resize( MainWindow::mainWindow()->size() );
#ifdef ANDROID
// On Galaxy S3 there are size problems observed
setMinimumSize( MainWindow::mainWindow()->size() );
setMaximumSize( MainWindow::mainWindow()->size() );
#endif
}
QVBoxLayout *mainLayout = new QVBoxLayout( this );
m_listWidget = new QWidget( this );
m_displayWidget = new QWidget( this );
m_editorWidget = new QWidget( this );
mainLayout->addWidget( m_listWidget );
mainLayout->addWidget( m_displayWidget );
mainLayout->addWidget( m_editorWidget );
m_displayWidget->hide();
m_editorWidget->hide();
//----------------------------------------------------------------------------
// List widget
//----------------------------------------------------------------------------
QVBoxLayout *listLayout = new QVBoxLayout( m_listWidget );
m_list = new QTreeWidget;
m_list->setRootIsDecorated( false );
m_list->setItemsExpandable( false );
m_list->setSortingEnabled( true );
m_list->setSelectionMode( QAbstractItemView::SingleSelection );
m_list->setSelectionBehavior( QAbstractItemView::SelectRows );
m_list->setAlternatingRowColors(true);
m_list->setColumnCount( 1 );
m_list->setFocusPolicy( Qt::StrongFocus );
m_list->setUniformRowHeights(true);
m_list->setHeaderLabel( tr( "METAR and TAF" ) );
m_list->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
m_list->setVerticalScrollMode( QAbstractItemView::ScrollPerPixel );
#ifdef ANDROID
QScrollBar* lvsb = m_list->verticalScrollBar();
lvsb->setStyleSheet( Layout::getCbSbStyle() );
#endif
#ifdef QSCROLLER
QScroller::grabGesture(m_list->viewport(), QScroller::LeftMouseButtonGesture);
#endif
#ifdef QTSCROLLER
QtScroller::grabGesture(m_list->viewport(), QtScroller::LeftMouseButtonGesture);
#endif
listLayout->addWidget( m_list );
QHBoxLayout* hbbox1 = new QHBoxLayout;
listLayout->addLayout( hbbox1 );
QPushButton* cmd = new QPushButton(tr("Add"), this);
hbbox1->addWidget(cmd);
connect (cmd, SIGNAL(clicked()), SLOT(slotShowAirportEditor()));
hbbox1->addSpacing( 10 );
m_listUpdateButton = new QPushButton(tr("Update"), this);
hbbox1->addWidget(m_listUpdateButton);
connect (m_listUpdateButton, SIGNAL(clicked()), SLOT(slotRequestWeatherData()));
hbbox1->addSpacing( 10 );
cmd = new QPushButton(tr("Details"), this);
hbbox1->addWidget(cmd);
connect (cmd, SIGNAL(clicked()), SLOT(slotDetails()));
QHBoxLayout* hbbox2 = new QHBoxLayout;
listLayout->addLayout( hbbox2 );
cmd = new QPushButton(tr("Delete"), this);
hbbox2->addWidget(cmd);
connect (cmd, SIGNAL(clicked()), SLOT(slotDeleteAirport()));
hbbox2->addSpacing( 10 );
//.........这里部分代码省略.........
示例13: QWidget
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"));
//.........这里部分代码省略.........
示例14: QWidget
/*
* Because Maemo 5 is using a special dialog design this window is declared
* as a tool window.
*/
SettingsPagePointDataLoading::SettingsPagePointDataLoading( QWidget *parent ) :
QWidget( parent )
{
setObjectName("SettingsPagePointDataLoading");
setAttribute( Qt::WA_DeleteOnClose );
setWindowFlags( Qt::Tool );
setWindowTitle(tr("Point data loading settings"));
setWindowModality( Qt::WindowModal );
if( _globalMainWindow )
{
// Resize the window to the same size as the main window has. That will
// completely hide the parent window.
resize( _globalMainWindow->size() );
}
QStringList mapDirs = GeneralConfig::instance()->getMapDirectories();
QVBoxLayout *topLayout = new QVBoxLayout( this );
topLayout->setSpacing(10);
m_fileTable = new QTableWidget( 0, 1, this );
m_fileTable->setToolTip( tr("Uncheck All to enable loading of single files.") );
m_fileTable->setSelectionBehavior( QAbstractItemView::SelectRows );
m_fileTable->setAlternatingRowColors( true );
m_fileTable->setShowGrid( true );
// set new row height from configuration
int afMargin = GeneralConfig::instance()->getListDisplayAFMargin();
m_fileTable->setItemDelegate( new RowDelegate( m_fileTable, afMargin ) );
m_fileTable->setVerticalScrollMode( QAbstractItemView::ScrollPerPixel );
m_fileTable->setHorizontalScrollMode( QAbstractItemView::ScrollPerPixel );
#ifdef ANDROID
QScrollBar* lvsb = m_fileTable->verticalScrollBar();
lvsb->setStyleSheet( Layout::getCbSbStyle() );
#endif
#ifdef QSCROLLER
QScroller::grabGesture( m_fileTable->viewport(), QScroller::LeftMouseButtonGesture );
#endif
#ifdef QTSCROLLER
QtScroller::grabGesture( m_fileTable->viewport(), QtScroller::LeftMouseButtonGesture );
#endif
QString style = "QTableView QTableCornerButton::section { background: gray }";
m_fileTable->setStyleSheet( style );
QHeaderView *vHeader = m_fileTable->verticalHeader();
style = "QHeaderView::section { width: 2em }";
vHeader->setStyleSheet( style );
connect( m_fileTable, SIGNAL(cellClicked ( int, int )),
SLOT(slot_toggleCheckBox( int, int )) );
connect( m_fileTable, SIGNAL(itemSelectionChanged()),
this, SLOT(slot_itemSelectionChanged()) );
QHeaderView* hHeader = m_fileTable->horizontalHeader();
hHeader->setStretchLastSection( true );
QString loadDirs;
for( int i = 0; i < mapDirs.size(); i++ )
{
if( i > 0 )
{
loadDirs.append("\n");
}
loadDirs += mapDirs.at(i) + "/points";
}
QTableWidgetItem *item = new QTableWidgetItem( loadDirs );
item->setTextAlignment( Qt::AlignLeft );
m_fileTable->setHorizontalHeaderItem( 0, item );
topLayout->addWidget( m_fileTable, 10 );
int buttonSize = Layout::getButtonSize();
int iconSize = buttonSize - 5;
m_delButton = new QPushButton;
m_delButton->setIcon( QIcon( GeneralConfig::instance()->loadPixmap( "delete.png" ) ) );
m_delButton->setIconSize(QSize(iconSize, iconSize));
m_delButton->setMinimumSize(buttonSize, buttonSize);
m_delButton->setMaximumSize(buttonSize, buttonSize);
m_delButton->setEnabled( false );
QPushButton *okButton = new QPushButton;
okButton->setIcon(QIcon(GeneralConfig::instance()->loadPixmap("ok.png")));
okButton->setIconSize(QSize(iconSize, iconSize));
okButton->setMinimumSize(buttonSize, buttonSize);
okButton->setMaximumSize(buttonSize, buttonSize);
//.........这里部分代码省略.........