本文整理汇总了C++中icon函数的典型用法代码示例。如果您正苦于以下问题:C++ icon函数的具体用法?C++ icon怎么用?C++ icon使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了icon函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ConfigDialog
PreferencesDialog::PreferencesDialog(QWidget *parent)
: ConfigDialog(parent, "PreferencesDialog")
{
iCount++;
server = new ServerSettings(0);
playback = new PlaybackSettings(0);
files = new FileSettings(0);
interface = new InterfaceSettings(0);
context = new ContextSettings(0);
cache = new CacheSettings(0);
scrobbling = new ScrobblingSettings(0);
server->load();
playback->load();
files->load();
interface->load();
context->load();
scrobbling->load();
addPage(QLatin1String("collection"), server, i18n("Collection"), Icons::self()->audioFileIcon, i18n("Collection Settings"));
addPage(QLatin1String("playback"), playback, i18n("Playback"), Icon("media-playback-start"), i18n("Playback Settings"));
addPage(QLatin1String("files"), files, i18n("Files"), Icons::self()->filesIcon, i18n("File Settings"));
addPage(QLatin1String("interface"), interface, i18n("Interface"), Icon("preferences-other"), i18n("Interface Settings"));
#ifdef ENABLE_STREAMS
streams = new StreamsSettings(0);
addPage(QLatin1String("streams"), streams, i18n("Streams"), Icons::self()->radioStreamIcon, i18n("Streams Settings"));
streams->load();
#endif
#ifdef ENABLE_ONLINE_SERVICES
online = new OnlineSettings(0);
addPage(QLatin1String("online"), online, i18n("Online"), Icon("applications-internet"), i18n("Online Providers"));
online->load();
#endif
addPage(QLatin1String("context"), context, i18n("Context"), Icons::self()->contextIcon, i18n("Context View Settings"));
addPage(QLatin1String("scrobbling"), scrobbling, i18n("Scrobbling"), Icons::self()->lastFmIcon, i18n("Scrobbling Settings"));
#ifdef ENABLE_HTTP_SERVER
http = new HttpServerSettings(0);
if (http->haveMultipleInterfaces()) {
http->load();
Icon icon("network-server");
if (icon.isNull()) {
icon=Icons::self()->streamIcon;
}
addPage(QLatin1String("http"), http, i18n("HTTP Server"), icon, i18n("HTTP Server Settings"));
} else {
http->deleteLater();
http=0;
}
#endif
#if defined CDDB_FOUND || defined MUSICBRAINZ5_FOUND
audiocd = new AudioCdSettings(0);
audiocd->load();
addPage(QLatin1String("cd"), audiocd, i18n("Audio CD"), Icon("media-optical"), i18n("Audio CD Settings"));
#endif
#ifdef ENABLE_PROXY_CONFIG
proxy = new ProxySettings(0);
proxy->load();
addPage(QLatin1String("proxy"), proxy, i18n("Proxy"), Icon("preferences-system-network"), i18nc("Qt-only", "Proxy Settings"));
#endif
#ifndef ENABLE_KDE_SUPPORT
shortcuts = new ShortcutsSettingsPage(0);
addPage(QLatin1String("shortcuts"), shortcuts, i18nc("Qt-only", "Shortcuts"), Icons::self()->shortcutsIcon, i18nc("Qt-only", "Keyboard Shortcut Settings"));
shortcuts->load();
#endif
addPage(QLatin1String("cache"), cache, i18n("Cache"), Icons::self()->folderIcon, i18n("Cached Items"));
#ifdef Q_OS_MAC
setCaption(i18n("Cantata Preferences"));
#else
setCaption(i18n("Configure"));
#endif
setAttribute(Qt::WA_DeleteOnClose);
setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
setCurrentPage(QLatin1String("collection"));
}
示例2: QPixmap
QPixmap KFileItemListView::createDragPixmap(const QSet<int>& indexes) const
{
if (!model()) {
return QPixmap();
}
const int itemCount = indexes.count();
Q_ASSERT(itemCount > 0);
if (itemCount == 1) {
return KItemListView::createDragPixmap(indexes);
}
// If more than one item is dragged, align the items inside a
// rectangular grid. The maximum grid size is limited to 5 x 5 items.
int xCount;
int size;
if (itemCount > 16) {
xCount = 5;
size = KIconLoader::SizeSmall;
} else if (itemCount > 9) {
xCount = 4;
size = KIconLoader::SizeSmallMedium;
} else {
xCount = 3;
size = KIconLoader::SizeMedium;
}
if (itemCount < xCount) {
xCount = itemCount;
}
int yCount = itemCount / xCount;
if (itemCount % xCount != 0) {
++yCount;
}
if (yCount > xCount) {
yCount = xCount;
}
// Draw the selected items into the grid cells.
QPixmap dragPixmap(xCount * size + xCount, yCount * size + yCount);
dragPixmap.fill(Qt::transparent);
QPainter painter(&dragPixmap);
int x = 0;
int y = 0;
QSetIterator<int> it(indexes);
while (it.hasNext()) {
const int index = it.next();
QPixmap pixmap = model()->data(index).value("iconPixmap").value<QPixmap>();
if (pixmap.isNull()) {
KIcon icon(model()->data(index).value("iconName").toString());
pixmap = icon.pixmap(size, size);
} else {
KPixmapModifier::scale(pixmap, QSize(size, size));
}
painter.drawPixmap(x, y, pixmap);
x += size + 1;
if (x >= dragPixmap.width()) {
x = 0;
y += size + 1;
}
if (y >= dragPixmap.height()) {
break;
}
}
return dragPixmap;
}
示例3: UT_ASSERT
bool EV_QtToolbar::synthesize(void)
{
// create a Qt toolbar from the info provided.
const EV_Toolbar_ActionSet * pToolbarActionSet = m_pQtApp->getToolbarActionSet();
UT_ASSERT(pToolbarActionSet);
XAP_Toolbar_ControlFactory * pFactory = m_pQtApp->getControlFactory();
UT_ASSERT(pFactory);
UT_uint32 nrLabelItemsInLayout = m_pToolbarLayout->getLayoutItemCount();
UT_ASSERT(nrLabelItemsInLayout > 0);
m_wToolbar = new QToolBar();
UT_ASSERT(m_wToolbar);
Qt::ToolButtonStyle style = getStyle();
m_wToolbar->setToolButtonStyle(style);
for (UT_uint32 k=0; (k < nrLabelItemsInLayout); k++)
{
EV_Toolbar_LayoutItem * pLayoutItem = m_pToolbarLayout->getLayoutItem(k);
UT_continue_if_fail(pLayoutItem);
XAP_Toolbar_Id id = pLayoutItem->getToolbarId();
EV_Toolbar_Action * pAction = pToolbarActionSet->getAction(id);
UT_ASSERT(pAction);
EV_Toolbar_Label * pLabel = m_pToolbarLabelSet->getLabel(id);
UT_ASSERT(pLabel);
const char * szToolTip = pLabel->getToolTip();
if (!szToolTip || !*szToolTip)
szToolTip = pLabel->getStatusMsg();
switch (pLayoutItem->getToolbarLayoutFlags())
{
case EV_TLF_Normal:
{
switch (pAction->getItemType())
{
case EV_TBIT_PushButton:
{
UT_ASSERT(g_ascii_strcasecmp(pLabel->getIconName(),"NoIcon")!=0);
if(pAction->getToolbarId() != AP_TOOLBAR_ID_INSERT_TABLE)
{
const char *icon_name = pLabel->getIconName();
QPixmap pixmap;
pixmap = abi_pixmap_from_toolbar_id (icon_name);
if(!pixmap.isNull())
{
QIcon icon(pixmap);
QString str = "";
QPushButton *item = new QPushButton(icon, str);
m_wToolbar->addWidget(item);
}
}
else
{
const char *icon_name = pLabel->getIconName();
QPixmap pixmap;
pixmap = abi_pixmap_from_toolbar_id (icon_name);
if(!pixmap.isNull())
{
QIcon icon(pixmap);
QString str = "";
QPushButton *item = new QPushButton(icon, str);
m_wToolbar->addWidget(item);
}
}
break;
}
case EV_TBIT_ToggleButton:
case EV_TBIT_GroupButton:
{
UT_ASSERT(g_ascii_strcasecmp(pLabel->getIconName(),"NoIcon")!=0);
const char *icon_name = pLabel->getIconName();
QPixmap pixmap;
pixmap = abi_pixmap_from_toolbar_id (icon_name);
if(!pixmap.isNull())
{
QIcon icon(pixmap);
QString str = "";
QPushButton *item = new QPushButton(icon, str);
item->setCheckable(true);
m_wToolbar->addWidget(item);
}
break;
}
case EV_TBIT_EditText:
{
break;
}
case EV_TBIT_DropDown:
{
break;
}
case EV_TBIT_ComboBox:
{
EV_Toolbar_Control * pControl = pFactory->getControl(this, id);
UT_ASSERT(pControl);
//.........这里部分代码省略.........
示例4: while
//--------------------------------------------------------------------------------------
//!
//--------------------------------------------------------------------------------------
void tWorkProfilesDialog::UpdateTable()
{
int currentRow = m_pProfilesTable->currentRow();
// clear all rows
while ( m_pProfilesTable->rowCount() > 0 )
{
// Remove and destroy the first row
for ( int column = 0; column < eColumnCount; ++column )
{
QTableWidgetItem* pItemToDelete = m_pProfilesTable->item( 0, column );
delete pItemToDelete;
}
m_pProfilesTable->removeRow( 0 );
}
int row = 0;
for ( int i = 0; i < tPilotMedusaInterface::cNumberOfWorkProfiles; ++i )
{
tPilotMedusaInterface::tWorkProfileSettings workProfile;
m_PilotDevice.GetMedusaInterface()->GetWorkProfileSettings( (unsigned char)i, &workProfile );
if ( workProfile.valid )
{
m_pProfilesTable->insertRow( row );
QIcon icon( *tWorkProfile::Pixmap( workProfile.iconId ) );
QTableWidgetItem* pIconItem = new QTableWidgetItem( icon, "" );
pIconItem->setTextAlignment( Qt::AlignCenter );
m_pProfilesTable->setItem( row, eIconColumn, pIconItem );
QString name = tWorkProfile::ValidName( workProfile.name );
QTableWidgetItem* pNameItem = new QTableWidgetItem( name );
pNameItem->setTextAlignment( Qt::AlignLeft | Qt::AlignVCenter );
m_pProfilesTable->setItem( row, eNameColumn, pNameItem );
QTableWidgetItem* pEnabledItem = new QTableWidgetItem();
pEnabledItem->setCheckState( workProfile.enabled? Qt::Checked : Qt::Unchecked );
// Set the flags so the user can't change the checkbox state
pEnabledItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
m_pProfilesTable->setItem( row, eEnabledColumn, pEnabledItem );
QTableWidgetItem* pActiveItem = new QTableWidgetItem();
bool active = ( i == m_PilotDevice.GetMedusaInterface()->GetWorkProfileActiveIndex() );
if ( active )
{
pActiveItem->setCheckState( Qt::Checked );
}
// Set the flags so the user can't change the checkbox state
pActiveItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
m_pProfilesTable->setItem( row, eActiveColumn, pActiveItem );
++row;
}
}
if ( row < tPilotMedusaInterface::cNumberOfWorkProfiles )
{
m_pProfilesTable->insertRow( row );
QTableWidgetItem* pIconItem = new QTableWidgetItem( "" );
m_pProfilesTable->setItem( row, eIconColumn, pIconItem );
QTableWidgetItem* pNewItem = new QTableWidgetItem( QString( tr( "New" ) + "..." ) );
pNewItem->setTextAlignment( Qt::AlignLeft | Qt::AlignVCenter );
m_pProfilesTable->setItem( row, eNameColumn, pNewItem );
}
currentRow = currentRow < m_pProfilesTable->rowCount() ? currentRow : 0;
m_pProfilesTable->selectRow( currentRow );
}
示例5: Q_UNUSED
void pDockWidgetTitleBar::paintEvent( QPaintEvent* event )
{
Q_UNUSED( event );
QRect rect = this->rect();
QPainter painter( this );
// native background paint for not common style / native paint
if ( ( mUseNativePaint || style()->inherits( "QMacStyle" ) || style()->inherits( "Oxygen::Style" ) ) && qobject_cast<pDockWidget*>( mDock ) ) {
QStyleOptionDockWidgetV2 optionDw;
((pDockWidget*)mDock)->initStyleOption( &optionDw );
optionDw.title.clear();
optionDw.closable = false;
optionDw.floatable = false;
optionDw.movable = false;
optionDw.rect = rect;
style()->drawControl( QStyle::CE_DockWidgetTitle, &optionDw, &painter, mDock );
}
// custom background
else {
QColor topColor = palette().color( QPalette::Highlight ).lighter( 130 );
QColor bottomColor = palette().color( QPalette::Highlight ).darker( 130 );
QLinearGradient gradient( rect.topLeft(), rect.bottomLeft() );
topColor.setAlphaF( .7 );
bottomColor.setAlphaF( .7 );
gradient.setColorAt( 0, topColor );
gradient.setColorAt( 1, bottomColor );
if ( mDock->features() & QDockWidget::DockWidgetVerticalTitleBar ) {
gradient.setFinalStop( rect.topRight() );
}
painter.setPen( Qt::NoPen );
painter.setBrush( gradient );
painter.drawRect( rect );
painter.setPen( bottomColor.darker( 130 ) );
painter.setBrush( Qt::NoBrush );
painter.drawRect( rect.adjusted( 0, 0, -1, -1 ) );
}
if ( mDock->features() & QDockWidget::DockWidgetVerticalTitleBar ) {
QTransform transform;
rect.setSize( QSize( rect.height(), rect.width() ) );
transform.rotate( -90 );
transform.translate( -rect.width(), 0 );
painter.setTransform( transform );
}
// icon / title
QStyleOptionButton optionB;
optionB.initFrom( mDock );
optionB.rect = rect.adjusted( 2, 0, -( orientation() == Qt::Horizontal ? minimumSizeHint().width() : minimumSizeHint().height() ), 0 );
optionB.text = mDock->windowTitle();
optionB.iconSize = windowIconSize();
optionB.icon = icon();
style()->drawControl( QStyle::CE_PushButtonLabel, &optionB, &painter, mDock );
}
示例6: wxFrame
// Constructor
WxCasFrame::WxCasFrame ( const wxString & title ) :
wxFrame ( ( wxFrame * ) NULL, -1, title, wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE )
{
// Give it an icon
#ifdef __WINDOWS__
wxIcon icon(wxT("wxcas"));
#else
wxIcon icon;
icon.CopyFromBitmap( WxCasPix::getPixmap( wxT( "wxcas" ) ) );
#endif
SetIcon ( icon );
// Prefs
wxConfigBase * prefs = wxConfigBase::Get();
m_maxLineCount = 0;
// Check if we have a previous DL max hit
double absoluteMaxDL = ( double ) ( prefs->Read ( WxCasCte::ABSOLUTE_MAX_DL_KEY, 0L ) ) / 1024.0; // Stored in bytes
wxDateTime absoluteMaxDlDate( ( time_t ) ( prefs->Read ( WxCasCte::ABSOLUTE_MAX_DL_DATE_KEY,
( long ) ( wxDateTime::Now().GetTicks() ) ) ) ); // Stored in Ticks
// Add Online Sig file
m_aMuleSig = new OnLineSig ( wxFileName( prefs->
Read ( WxCasCte::AMULESIG_PATH_KEY,
WxCasCte::DEFAULT_AMULESIG_PATH ),
WxCasCte::AMULESIG_FILENAME ),
absoluteMaxDL, absoluteMaxDlDate );
//Save absolute hit if we reach it during constructing
if ( m_aMuleSig->IsSessionMaxDlChanged() ) {
SaveAbsoluteHits();
}
#ifdef __LINUX__ // System monitoring on Linux
m_sysMonitor = new LinuxMon ();
#endif
// Status Bar
CreateStatusBar ();
SetStatusText ( _( "Welcome!" ) );
// Frame Vertical sizer
m_frameVBox = new wxBoxSizer ( wxVERTICAL );
// Add Main panel to frame (needed by win32 for padding sub panels)
m_mainPanel = new wxPanel ( this, -1 );
// Main Panel Vertical Sizer
m_mainPanelVBox = new wxBoxSizer ( wxVERTICAL );
// Main Panel static line
m_staticLine = new wxStaticLine ( m_mainPanel, -1 );
#ifdef __WINDOWS__
m_BottomStaticLine = new wxStaticLine ( m_mainPanel, -1 );
#endif
// Statistics Static Vertical Box Sizer
m_sigPanelSBox = new wxStaticBox ( m_mainPanel, -1, _( "aMule" ) );
m_sigPanelSBoxSizer = new wxStaticBoxSizer ( m_sigPanelSBox, wxVERTICAL );
// Hit Static Horizontal Box Sizer
m_hitPanelSBox = new wxStaticBox ( m_mainPanel, -1, _( "Maximum DL rate since wxCas is running" ) );
m_hitPanelSBoxSizer = new wxStaticBoxSizer ( m_hitPanelSBox, wxHORIZONTAL );
// Hit Static Horizontal Box Sizer
m_absHitPanelSBox = new wxStaticBox ( m_mainPanel, -1, _( "Absolute Maximum DL rate during wxCas previous runs" ) );
m_absHitPanelSBoxSizer = new wxStaticBoxSizer ( m_absHitPanelSBox, wxHORIZONTAL );
// Statistic labels
m_statLine_1 = new wxStaticText ( m_mainPanel, -1, MakeStatLine_1() );
m_statLine_2 = new wxStaticText ( m_mainPanel, -1, MakeStatLine_2() );
m_statLine_3 = new wxStaticText ( m_mainPanel, -1, MakeStatLine_3() );
m_statLine_4 = new wxStaticText ( m_mainPanel, -1, MakeStatLine_4() );
m_statLine_5 = new wxStaticText ( m_mainPanel, -1, MakeStatLine_5() );
m_statLine_6 = new wxStaticText ( m_mainPanel, -1, MakeStatLine_6() );
m_statLine_7 = new wxStaticText ( m_mainPanel, -1, MakeStatLine_7() );
m_hitLine = new wxStaticText ( m_mainPanel, -1, MakeHitsLine_1() );
m_hitButton =
new wxButton ( m_mainPanel, ID_HIT_BUTTON, wxString ( _( "Reset" ) ) );
m_absHitLine = new wxStaticText ( m_mainPanel, -1, MakeHitsLine_2() );
m_absHitButton =
new wxButton ( m_mainPanel, ID_ABS_HIT_BUTTON, wxString ( _( "Reset" ) ) );
#ifdef __LINUX__ // System monitoring on Linux
// Monitoring Static Vertical Box Sizer
m_monPanelSBox = new wxStaticBox ( m_mainPanel, -1, _( "System" ) );
m_monPanelSBoxSizer = new wxStaticBoxSizer ( m_monPanelSBox, wxVERTICAL );
m_sysLine_1 = new wxStaticText ( m_mainPanel, -1, MakeSysLine_1() );
m_sysLine_2 = new wxStaticText ( m_mainPanel, -1, MakeSysLine_2() );
#endif
//.........这里部分代码省略.........
示例7: logMessage
QLayout* SceneLabelDialog::createContent()
{
logMessage("DSceneLabel::createContent()");
txtPointX = new ValueLineEdit();
txtPointY = new ValueLineEdit();
connect(txtPointX, SIGNAL(evaluated(bool)), this, SLOT(evaluated(bool)));
connect(txtPointY, SIGNAL(evaluated(bool)), this, SLOT(evaluated(bool)));
cmbMaterial = new QComboBox();
connect(cmbMaterial, SIGNAL(currentIndexChanged(int)), this, SLOT(doMaterialChanged(int)));
btnMaterial = new QPushButton(icon("three-dots"), "");
btnMaterial->setMaximumSize(btnMaterial->sizeHint());
connect(btnMaterial, SIGNAL(clicked()), this, SLOT(doMaterialClicked()));
txtArea = new ValueLineEdit();
txtArea->setMinimum(0.0);
connect(txtArea, SIGNAL(evaluated(bool)), this, SLOT(evaluated(bool)));
txtPolynomialOrder = new QSpinBox(this);
txtPolynomialOrder->setMinimum(0);
txtPolynomialOrder->setMaximum(10);
// coordinates must be greater then or equal to 0 (axisymmetric case)
if (Util::scene()->problemInfo()->problemType == ProblemType_Axisymmetric)
txtPointX->setMinimum(0.0);
// coordinates
QFormLayout *layoutCoordinates = new QFormLayout();
layoutCoordinates->addRow(Util::scene()->problemInfo()->labelX() + " (m):", txtPointX);
layoutCoordinates->addRow(Util::scene()->problemInfo()->labelY() + " (m):", txtPointY);
QGroupBox *grpCoordinates = new QGroupBox(tr("Coordinates"));
grpCoordinates->setLayout(layoutCoordinates);
// marker
QHBoxLayout *layoutMaterial = new QHBoxLayout();
layoutMaterial->addWidget(cmbMaterial);
layoutMaterial->addWidget(btnMaterial);
// order
chkPolynomialOrder = new QCheckBox();
connect(chkPolynomialOrder, SIGNAL(stateChanged(int)), this, SLOT(doPolynomialOrder(int)));
QHBoxLayout *layoutPolynomialOrder = new QHBoxLayout();
layoutPolynomialOrder->addWidget(chkPolynomialOrder);
layoutPolynomialOrder->addWidget(txtPolynomialOrder);
layoutPolynomialOrder->addWidget(new QLabel(tr("Global order is %1.").arg(Util::scene()->problemInfo()->polynomialOrder)));
// area
chkArea = new QCheckBox();
connect(chkArea, SIGNAL(stateChanged(int)), this, SLOT(doArea(int)));
QHBoxLayout *layoutArea = new QHBoxLayout();
layoutArea->addWidget(chkArea);
layoutArea->addWidget(txtArea);
// mesh
QFormLayout *layoutMeshParameters = new QFormLayout();
layoutMeshParameters->addRow(tr("Triangle area (m):"), layoutArea);
layoutMeshParameters->addRow(tr("Polynomial order (-):"), layoutPolynomialOrder);
QGroupBox *grpMeshParameters = new QGroupBox(tr("Mesh parameters"));
grpMeshParameters->setLayout(layoutMeshParameters);
QFormLayout *layout = new QFormLayout();
layout->addRow(tr("Material:"), layoutMaterial);
layout->addRow(grpCoordinates);
layout->addRow(grpMeshParameters);
fillComboBox();
return layout;
}
示例8: setError
void PinEntryDialog::setError( const QString& txt )
{
if( !txt.isNull() )_icon->setPixmap( icon( QStyle::SP_MessageBoxCritical ) );
_error->setText( txt );
_error->setVisible( !txt.isEmpty() );
}
示例9: QDialog
PinEntryDialog::PinEntryDialog( QWidget* parent, const char* name,
int timeout, bool modal, bool enable_quality_bar )
: QDialog( parent, Qt::WindowStaysOnTopHint ), _grabbed( false )
{
setWindowFlags( windowFlags() & ~Qt::WindowContextHelpButtonHint );
if ( modal ) {
setWindowModality( Qt::ApplicationModal );
}
_icon = new QLabel( this );
_icon->setPixmap( icon() );
_error = new QLabel( this );
_error->setWordWrap(true);
QPalette pal;
pal.setColor( QPalette::WindowText, Qt::red );
_error->setPalette( pal );
_error->hide();
_desc = new QLabel( this );
_desc->setWordWrap(true);
_desc->hide();
_prompt = new QLabel( this );
_prompt->hide();
_edit = new QSecureLineEdit( this );
_edit->setMaxLength( 256 );
_prompt->setBuddy( _edit );
if (enable_quality_bar)
{
_quality_bar_label = new QLabel( this );
_quality_bar_label->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
_quality_bar = new QProgressBar( this );
_quality_bar->setAlignment( Qt::AlignCenter );
_have_quality_bar = true;
}
else
_have_quality_bar = false;
QDialogButtonBox* const buttons = new QDialogButtonBox( this );
buttons->setStandardButtons( QDialogButtonBox::Ok | QDialogButtonBox::Cancel );
_ok = buttons->button( QDialogButtonBox::Ok );
_cancel = buttons->button( QDialogButtonBox::Cancel );
_ok->setDefault(true);
if ( style()->styleHint( QStyle::SH_DialogButtonBox_ButtonsHaveIcons ) )
{
_ok->setIcon( style()->standardIcon( QStyle::SP_DialogOkButton ) );
_cancel->setIcon( style()->standardIcon( QStyle::SP_DialogCancelButton ) );
}
if (timeout > 0) {
_timer = new QTimer(this);
connect(_timer, SIGNAL(timeout()), this, SLOT(slotTimeout()));
_timer->start(timeout*1000);
}
else
_timer = NULL;
connect( buttons, SIGNAL(accepted()), this, SLOT(accept()) );
connect( buttons, SIGNAL(rejected()), this, SLOT(reject()) );
connect( _edit, SIGNAL( textChanged(secqstring) ),
this, SLOT( updateQuality(secqstring) ) );
_edit->setFocus();
QGridLayout* const grid = new QGridLayout( this );
grid->addWidget( _icon, 0, 0, 5, 1, Qt::AlignTop|Qt::AlignLeft );
grid->addWidget( _error, 1, 1, 1, 2 );
grid->addWidget( _desc, 2, 1, 1, 2 );
//grid->addItem( new QSpacerItem( 0, _edit->height() / 10, QSizePolicy::Minimum, QSizePolicy::Fixed ), 1, 1 );
grid->addWidget( _prompt, 3, 1 );
grid->addWidget( _edit, 3, 2 );
if( enable_quality_bar )
{
grid->addWidget( _quality_bar_label, 4, 1 );
grid->addWidget( _quality_bar, 4, 2 );
}
grid->addWidget( buttons, 5, 0, 1, 3 );
grid->setSizeConstraint( QLayout::SetFixedSize );
}
示例10: QDialog
LayoutDlg::LayoutDlg(QWidget *parent, Qt::WindowFlags f)
: QDialog(parent,f)
{
setWindowTitle(tr("User Infomation"));
// create
label1 = new QLabel(tr("User Name:"));
label2 = new QLabel(tr("Name:"));
label3 = new QLabel(tr("Sex"));
label4 = new QLabel(tr("Department:"));
label5 = new QLabel(tr("Age:"));
labelOther = new QLabel(tr("Remark"));
labelOther->setFrameStyle(QFrame::Panel|QFrame::Sunken);
lineEditUser = new QLineEdit();
lineEditName = new QLineEdit();
comboBoxSex = new QComboBox();
comboBoxSex->insertItem(0,tr("Female"));
comboBoxSex->insertItem(1,tr("Male"));
textEditDepartment = new QTextEdit();
lineEditAge = new QLineEdit();
label7 = new QLabel(tr("Head"));
labelIcon = new QLabel();
QPixmap icon(":/images/icon.png");
labelIcon->resize(icon.width(),icon.height());
labelIcon->setPixmap(icon);
pushButtonIcon = new QPushButton();
pushButtonIcon->setText(tr("Change"));
QHBoxLayout *hLayout = new QHBoxLayout;
hLayout->setSpacing(20);
hLayout->addWidget(label7);
hLayout->addWidget(labelIcon);
hLayout->addWidget(pushButtonIcon);
label6 = new QLabel(tr("Individual:"));
textEditDisc = new QTextEdit();
pushButtonOK = new QPushButton(tr("OK"));
pushButtonExit = new QPushButton(tr("Cancel"));
// Lay out
// left layout -- is a grid layout
QGridLayout * leftLayout = new QGridLayout();
int labelCol = 0;
int contentCol = 1;
leftLayout->addWidget(label1,0,labelCol); // user name row
leftLayout->addWidget(lineEditUser,0,contentCol);
leftLayout->addWidget(label2,1,labelCol); // name row
leftLayout->addWidget(lineEditName,1,contentCol);
leftLayout->addWidget(label3,2,labelCol); // sex row
leftLayout->addWidget(comboBoxSex,2,contentCol);
leftLayout->addWidget(label4,3,labelCol,Qt::AlignTop); // department row
leftLayout->addWidget(textEditDepartment,3,contentCol);
leftLayout->addWidget(label5,4,labelCol); // age row
leftLayout->addWidget(lineEditAge,4,contentCol);
leftLayout->addWidget(labelOther,5,labelCol,1,2); // other
leftLayout->setColumnStretch(0,1);
leftLayout->setColumnStretch(1,3);
// right layout -- is a vBoxLayout
QVBoxLayout *rightLayout = new QVBoxLayout();
rightLayout->setMargin(10);
rightLayout->addLayout(hLayout);
rightLayout->addWidget(label6);
rightLayout->addWidget(textEditDisc);
// buttom layout -- is a hBoxLayout
QHBoxLayout * bottomLayout = new QHBoxLayout();
bottomLayout->addStretch();
bottomLayout->addWidget(pushButtonOK);
bottomLayout->addWidget(pushButtonExit);
// main layout -- is a GridLayout
QGridLayout * mainLayout = new QGridLayout(this);
mainLayout->setMargin(15);
mainLayout->setSpacing(10);
mainLayout->addLayout(leftLayout,0,0);
mainLayout->addLayout(rightLayout,0,1);
mainLayout->addLayout(bottomLayout,1,0,1,2);
mainLayout->setSizeConstraint(QLayout::SetFixedSize);
connect(pushButtonExit,SIGNAL(clicked()),this,SLOT(reject()));
}
示例11: sep
//.........这里部分代码省略.........
QTreeWidgetItem *fitem; //nuovo elemento da allocare in lista
QTreeWidgetItem *tmpItem; //puntatore a elemento temporaneo
bool foldFound = false; //se ho trovato l'elemento...
bool itemFound = false;
for ( int j = 0; j < singleItem.size(); j++ ) {//per ogni cartella ramifico...
itemFound = false;
foldFound = false;
//-------------------queste operazioni avvengono solo ed esclusivamente al primo ciclo---------------------//
if ( j == 0 ) { //se e' il primo ciclo limitiamo la ricerca ai top level items
for ( int c = 0; c < listv -> topLevelItemCount(); c++ ) { //se trovo l'elemento tra i top level setto il current
if ( ( listv -> topLevelItem ( c ) ) -> text ( 0 ) == singleItem[j] ) {
tmpItem = listv -> topLevelItem ( c );
foldFound = true;
break; //se ho trovato l'elemento è inutile continuare il ciclo
}
}
if ( foldFound == false ) { //altrimenti alloco in lista in topLevel.. Questo accade anche se non è stato eseguito nessun ciclo
fitem = new QTreeWidgetItem ( listv );
fitem -> setText ( 0, singleItem[j] );
tmpItem = fitem;
}
}
else { //------------------queste operazioni avvengono per tutti gli altri cicli-------------------//
//cerco ciò che mi interessa tra i child dell currentItem() attuale
for ( int c=0; c < tmpItem -> childCount(); c++ ) {
if ( tmpItem->child ( c ) -> text ( 0 ) == singleItem[j] ) {
tmpItem = tmpItem->child ( c ); //se lo trovo setto il current item
itemFound = true;
break; //se ho trovato l'elemento è inutile continuare il ciclo
}
}
if (( itemFound == false ) && (!singleItem[j].isEmpty())) { //altrimenti alloco e setto il currentItem
fitem = new QTreeWidgetItem ( tmpItem );
fitem -> setText ( 0, singleItem[j] );
tmpItem = fitem;
}
}
}
//flist[i].remove(62, flist[i].size());
QStringList dlist = (flist.at(i)).split(" ", QString::SkipEmptyParts ); // generiamo una lista contenente i parametri dei file
//puts(dlist[4].toAscii() + dlist[6].toAscii());
//if (!((dlist[6] == "stor") && (dlist[4] == "bx"))) { //è inutile scrivere gli attributi della cartella
// provo a vedere se basta leggere la "d" dai permessi per individuare una cartella invece di un controllo
// fatto nella riga precedente.
if (dlist[0][0] != QChar('d')) {
fitem -> setText(4, dlist[7] + " " + dlist[8]); // modified
QString size = KLocale( QString() ).formatByteSize(dlist[3].toDouble()); // 3 -> dimensione originale del file
fitem -> setText(1, size);
size = KLocale( QString() ).formatByteSize(dlist[5].toDouble()); // 5 -> dimensione packed del file
fitem -> setText(2, size);
fitem -> setText(5, dlist[0]); // attributi
fitem -> setText(7, dlist[4] + " " + dlist[6]); // metodo
if ((dlist[4][0] == QChar('B')) || (dlist[4][0] == QChar('T'))) crypted = true;
else crypted = false;
fitem -> setText(8, dlist[1] + " " + dlist[2]); // version and so
// calcolo il ratio
float ratio = 0;
if (dlist[3].toInt() != 0) {
ratio = (100.0 * dlist[5].toFloat() / dlist[3].toFloat());
ratio = abs(ratio - 100);
}
fitem -> setText(3, QString().setNum(ratio) + "%");
// // akuRatioWidget *ratioWidget = new akuRatioWidget(ratio);
// // listv -> setItemWidget(fitem, 3, ratioWidget);
//
fitem -> setTextAlignment ( 1, Qt::AlignRight | Qt::AlignVCenter );
fitem -> setTextAlignment ( 2, Qt::AlignRight | Qt::AlignVCenter );
fitem -> setTextAlignment ( 3, Qt::AlignHCenter | Qt::AlignVCenter );
fitem -> setTextAlignment ( 5, Qt::AlignHCenter | Qt::AlignVCenter );
fitem -> setTextAlignment ( 7, Qt::AlignRight | Qt::AlignVCenter );
fitem -> setTextAlignment ( 8, Qt::AlignCenter | Qt::AlignVCenter );
KMimeType::Ptr mimePtr = KMimeType::findByUrl(KUrl(singleItem[numeroPezziPercorso]));
KIcon icon(mimePtr -> iconName());
fitem -> setIcon (0, icon);
fitem -> setText(9, mimePtr->name());
}
if (crypted == true) {
fitem -> setIcon(10, KIcon("dialog-password"));
fileswithpass = true;
}
}
QStringList archinfo;
archinfo = lastline.split ( " ", QString::SkipEmptyParts );
archiveDetails << archinfo[0] << KLocale(archinfo[2] ).formatByteSize(archinfo[2].toULong()) << KLocale(archinfo[5] ).formatByteSize(archinfo[5].toULong());
QString ratio = archinfo.at (8);
ratio.remove (ratio.length() - 1, 1);
ratioBar -> setRatio (int(ratio.toFloat() + 0.5f));
return fileswithpass;
}
示例12: register_core_singletons
Error Main::setup2() {
OS::get_singleton()->initialize(video_mode,video_driver_idx,audio_driver_idx);
if (init_use_custom_pos) {
OS::get_singleton()->set_window_position(init_custom_pos);
}
register_core_singletons();
MAIN_PRINT("Main: Setup Logo");
bool show_logo=true;
#ifdef JAVASCRIPT_ENABLED
show_logo=false;
#endif
if (init_screen!=-1) {
OS::get_singleton()->set_current_screen(init_screen);
}
if (init_windowed) {
//do none..
} else if (init_maximized) {
OS::get_singleton()->set_window_maximized(true);
} else if (init_fullscreen) {
OS::get_singleton()->set_window_fullscreen(true);
}
MAIN_PRINT("Main: Load Remaps");
path_remap->load_remaps();
if (show_logo) { //boot logo!
String boot_logo_path=GLOBAL_DEF("application/boot_splash",String());
bool boot_logo_scale=GLOBAL_DEF("application/boot_splash_fullsize",true);
Globals::get_singleton()->set_custom_property_info("application/boot_splash",PropertyInfo(Variant::STRING,"application/boot_splash",PROPERTY_HINT_FILE,"*.png"));
Image boot_logo;
boot_logo_path = boot_logo_path.strip_edges();
if (boot_logo_path!=String() /*&& FileAccess::exists(boot_logo_path)*/) {
print_line("Boot splash path: "+boot_logo_path);
Error err = boot_logo.load(boot_logo_path);
}
if (!boot_logo.empty()) {
OS::get_singleton()->_msec_splash=OS::get_singleton()->get_ticks_msec();
Color clear = GLOBAL_DEF("render/default_clear_color",Color(0.3,0.3,0.3));
VisualServer::get_singleton()->set_default_clear_color(clear);
Color boot_bg = GLOBAL_DEF("application/boot_bg_color", clear);
VisualServer::get_singleton()->set_boot_image(boot_logo, boot_bg,boot_logo_scale);
#ifndef TOOLS_ENABLED
//no tools, so free the boot logo (no longer needed)
// Globals::get_singleton()->set("application/boot_logo",Image());
#endif
} else {
#ifndef NO_DEFAULT_BOOT_LOGO
MAIN_PRINT("Main: Create bootsplash");
Image splash(boot_splash_png);
MAIN_PRINT("Main: ClearColor");
VisualServer::get_singleton()->set_default_clear_color(boot_splash_bg_color);
MAIN_PRINT("Main: Image");
VisualServer::get_singleton()->set_boot_image(splash, boot_splash_bg_color,false);
#endif
MAIN_PRINT("Main: DCC");
VisualServer::get_singleton()->set_default_clear_color(GLOBAL_DEF("render/default_clear_color",Color(0.3,0.3,0.3)));
MAIN_PRINT("Main: END");
}
Image icon(app_icon_png);
OS::get_singleton()->set_icon(icon);
}
GLOBAL_DEF("application/icon",String());
Globals::get_singleton()->set_custom_property_info("application/icon",PropertyInfo(Variant::STRING,"application/icon",PROPERTY_HINT_FILE,"*.png,*.webp"));
if (bool(GLOBAL_DEF("display/emulate_touchscreen",false))) {
if (!OS::get_singleton()->has_touchscreen_ui_hint() && Input::get_singleton()) {
//only if no touchscreen ui hint, set emulation
InputDefault *id = Input::get_singleton()->cast_to<InputDefault>();
if (id)
id->set_emulate_touch(true);
}
}
MAIN_PRINT("Main: Load Remaps");
MAIN_PRINT("Main: Load Scene Types");
register_scene_types();
register_server_types();
GLOBAL_DEF("display/custom_mouse_cursor",String());
GLOBAL_DEF("display/custom_mouse_cursor_hotspot",Vector2());
Globals::get_singleton()->set_custom_property_info("display/custom_mouse_cursor",PropertyInfo(Variant::STRING,"display/custom_mouse_cursor",PROPERTY_HINT_FILE,"*.png,*.webp"));
//.........这里部分代码省略.........
示例13: QWidget
SplashScreen::SplashScreen(Qt::WindowFlags f, const NetworkStyle *networkStyle) :
QWidget(0, f), curAlignment(0)
{
// set reference point, paddings
int paddingRight = 50;
int paddingTop = 50;
int titleVersionVSpace = 17;
int titleCopyrightVSpace = 40;
float fontFactor = 1.0;
float devicePixelRatio = 1.0;
#if QT_VERSION > 0x050100
devicePixelRatio = ((QGuiApplication*)QCoreApplication::instance())->devicePixelRatio();
#endif
// define text to place
QString titleText = tr("Bitcoin Core");
QString versionText = QString("Version %1").arg(QString::fromStdString(FormatFullVersion()));
QString copyrightText = QChar(0xA9)+QString(" 2009-%1 ").arg(COPYRIGHT_YEAR) + QString(tr("The Bitcoin Core developers"));
QString titleAddText = networkStyle->getTitleAddText();
QString font = QApplication::font().toString();
// create a bitmap according to device pixelratio
QSize splashSize(480*devicePixelRatio,320*devicePixelRatio);
pixmap = QPixmap(splashSize);
#if QT_VERSION > 0x050100
// change to HiDPI if it makes sense
pixmap.setDevicePixelRatio(devicePixelRatio);
#endif
QPainter pixPaint(&pixmap);
pixPaint.setPen(QColor(100,100,100));
// draw a slightly radial gradient
QRadialGradient gradient(QPoint(0,0), splashSize.width()/devicePixelRatio);
gradient.setColorAt(0, Qt::white);
gradient.setColorAt(1, QColor(247,247,247));
QRect rGradient(QPoint(0,0), splashSize);
pixPaint.fillRect(rGradient, gradient);
// draw the bitcoin icon, expected size of PNG: 1024x1024
QRect rectIcon(QPoint(-150,-122), QSize(430,430));
const QSize requiredSize(1024,1024);
QPixmap icon(networkStyle->getAppIcon().pixmap(requiredSize));
pixPaint.drawPixmap(rectIcon, icon);
// check font size and drawing with
pixPaint.setFont(QFont(font, 33*fontFactor));
QFontMetrics fm = pixPaint.fontMetrics();
int titleTextWidth = fm.width(titleText);
if(titleTextWidth > 160) {
// strange font rendering, Arial probably not found
fontFactor = 0.75;
}
pixPaint.setFont(QFont(font, 33*fontFactor));
fm = pixPaint.fontMetrics();
titleTextWidth = fm.width(titleText);
pixPaint.drawText(pixmap.width()/devicePixelRatio-titleTextWidth-paddingRight,paddingTop,titleText);
pixPaint.setFont(QFont(font, 15*fontFactor));
// if the version string is to long, reduce size
fm = pixPaint.fontMetrics();
int versionTextWidth = fm.width(versionText);
if(versionTextWidth > titleTextWidth+paddingRight-10) {
pixPaint.setFont(QFont(font, 10*fontFactor));
titleVersionVSpace -= 5;
}
pixPaint.drawText(pixmap.width()/devicePixelRatio-titleTextWidth-paddingRight+2,paddingTop+titleVersionVSpace,versionText);
// draw copyright stuff
pixPaint.setFont(QFont(font, 10*fontFactor));
pixPaint.drawText(pixmap.width()/devicePixelRatio-titleTextWidth-paddingRight,paddingTop+titleCopyrightVSpace,copyrightText);
// draw additional text if special network
if(!titleAddText.isEmpty()) {
QFont boldFont = QFont(font, 10*fontFactor);
boldFont.setWeight(QFont::Bold);
pixPaint.setFont(boldFont);
fm = pixPaint.fontMetrics();
int titleAddTextWidth = fm.width(titleAddText);
pixPaint.drawText(pixmap.width()/devicePixelRatio-titleAddTextWidth-10,15,titleAddText);
}
pixPaint.end();
// Set window title
setWindowTitle(titleText + " " + titleAddText);
// Resize window and move to center of desktop, disallow resizing
QRect r(QPoint(), QSize(pixmap.size().width()/devicePixelRatio,pixmap.size().height()/devicePixelRatio));
resize(r.size());
setFixedSize(r.size());
move(QApplication::desktop()->screenGeometry().center() - r.center());
//.........这里部分代码省略.........
示例14: icon
QIcon QtPropertyBrowserUtils::fontValueIcon(const QFont &f)
{
QIcon icon(fontValuePixmap(f, 16));
icon.addPixmap(fontValuePixmap(f, 32));
return icon;
}
示例15: icon
QBitmap QWaylandMaterialDecoration::buttonIcon(const QString &name) const
{
QIcon icon(":/icons/" + name + ".svg");
QPixmap pixmap = icon.pixmap(QSize(BUTTON_WIDTH, BUTTON_WIDTH));
return pixmap.createMaskFromColor(QColor("black"), Qt::MaskOutColor);
}