• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ setFixedSize函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中setFixedSize函数的典型用法代码示例。如果您正苦于以下问题:C++ setFixedSize函数的具体用法?C++ setFixedSize怎么用?C++ setFixedSize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了setFixedSize函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: QWidget

    QWidget* MainPage::showNoContactsYetSuggestions(QWidget *parent, std::function<void()> addNewContactsRoutine)
    {
        if (!noContactsYetSuggestions_)
        {
            noContactsYetSuggestions_ = new QWidget(parent);
            noContactsYetSuggestions_->setSizePolicy(QSizePolicy::Policy::Expanding, QSizePolicy::Policy::Expanding);
            noContactsYetSuggestions_->setStyleSheet("background-color: white;");
            {
                auto l = new QVBoxLayout(noContactsYetSuggestions_);
                l->setContentsMargins(0, 0, 0, 0);
                l->setSpacing(0);
                l->setAlignment(Qt::AlignCenter);
                {
                    auto p = new QWidget(noContactsYetSuggestions_);
                    p->setSizePolicy(QSizePolicy::Policy::Expanding, QSizePolicy::Policy::Preferred);
                    auto pl = new QHBoxLayout(p);
                    pl->setContentsMargins(0, 0, 0, 0);
                    pl->setAlignment(Qt::AlignCenter);
                    {
                        auto w = new QWidget(p);
                        w->setSizePolicy(QSizePolicy::Policy::Fixed, QSizePolicy::Policy::Fixed);
                        w->setStyleSheet("image: url(:/resources/main_window/content_logo_200.png);");
                        w->setFixedSize(Utils::scale_value(64), Utils::scale_value(64));
                        pl->addWidget(w);
                    }
                    l->addWidget(p);
                }
                {
                    auto p = new QWidget(noContactsYetSuggestions_);
                    p->setSizePolicy(QSizePolicy::Policy::Expanding, QSizePolicy::Policy::Preferred);
                    auto pl = new QHBoxLayout(p);
                    pl->setContentsMargins(0, 0, 0, 0);
                    pl->setAlignment(Qt::AlignCenter);
                    {
                        auto w = new Ui::TextEmojiWidget(p, Utils::FontsFamily::SEGOE_UI, Utils::scale_value(24), QColor("#282828"), Utils::scale_value(44));
                        w->setSizePolicy(QSizePolicy::Policy::Preferred, w->sizePolicy().verticalPolicy());
                        w->setText(QT_TRANSLATE_NOOP("placeholders", "Install ICQ on mobile"));
                        pl->addWidget(w);
                    }
                    l->addWidget(p);
                }
                {
                    auto p = new QWidget(noContactsYetSuggestions_);
                    p->setSizePolicy(QSizePolicy::Policy::Expanding, QSizePolicy::Policy::Preferred);
                    auto pl = new QHBoxLayout(p);
                    pl->setContentsMargins(0, 0, 0, 0);
                    pl->setAlignment(Qt::AlignCenter);
                    {
                        auto w = new Ui::TextEmojiWidget(p, Utils::FontsFamily::SEGOE_UI, Utils::scale_value(24), QColor("#282828"), Utils::scale_value(30));
                        w->setSizePolicy(QSizePolicy::Policy::Preferred, w->sizePolicy().verticalPolicy());
                        w->setText(QT_TRANSLATE_NOOP("placeholders", "to synchronize your contacts"));
                        pl->addWidget(w);
                    }
                    l->addWidget(p);
                }
                {
                    auto p = new QWidget(noContactsYetSuggestions_);
                    p->setSizePolicy(QSizePolicy::Policy::Expanding, QSizePolicy::Policy::Preferred);
                    auto pl = new QHBoxLayout(p);
                    pl->setContentsMargins(0, Utils::scale_value(28), 0, 0);
                    pl->setSpacing(Utils::scale_value(8));
                    pl->setAlignment(Qt::AlignCenter);
                    {
                        auto as = new QPushButton(p);
                        as->setSizePolicy(QSizePolicy::Policy::Fixed, QSizePolicy::Policy::Fixed);
                        as->setFlat(true);
                        auto asu = QString(":/resources/placeholders/content_badge_appstore_%1_200.png").arg(Ui::get_gui_settings()->get_value(settings_language, QString("")).toUpper());
                        auto asi = QString("QPushButton { border-image: url(%1); } QPushButton:hover { border-image: url(%2); }").arg(asu).arg(asu);
                        as->setStyleSheet(asi);
                        as->setFixedSize(Utils::scale_value(152), Utils::scale_value(44));
                        as->setCursor(Qt::PointingHandCursor);
                        parent->connect(as, &QPushButton::clicked, []()
                        {
                            QDesktopServices::openUrl(QUrl("https://app.appsflyer.com/id302707408?pid=icq_win"));
                            GetDispatcher()->post_stats_to_core(core::stats::stats_event_names::cl_empty_ios);
                        });
                        pl->addWidget(as);

                        auto gp = new QPushButton(p);
                        gp->setSizePolicy(QSizePolicy::Policy::Fixed, QSizePolicy::Policy::Fixed);
                        gp->setFlat(true);
                        auto gpu = QString(":/resources/placeholders/content_badge_gplay_%1_200.png").arg(Ui::get_gui_settings()->get_value(settings_language, QString("")).toUpper());
                        auto gpi = QString("QPushButton { border-image: url(%1); } QPushButton:hover { border-image: url(%2); }").arg(gpu).arg(gpu);
                        gp->setStyleSheet(gpi);
                        gp->setFixedSize(Utils::scale_value(152), Utils::scale_value(44));
                        gp->setCursor(Qt::PointingHandCursor);
                        parent->connect(gp, &QPushButton::clicked, []()
                        {
                            QDesktopServices::openUrl(QUrl("https://app.appsflyer.com/com.icq.mobile.client?pid=icq_win"));
                            GetDispatcher()->post_stats_to_core(core::stats::stats_event_names::cl_empty_android);
                        });
                        pl->addWidget(gp);
                    }
                    l->addWidget(p);
                }
                {
                    auto p = new QWidget(noContactsYetSuggestions_);
                    p->setSizePolicy(QSizePolicy::Policy::Expanding, QSizePolicy::Policy::Preferred);
                    auto pl = new QHBoxLayout(p);
                    pl->setContentsMargins(0, 0, 0, 0);
//.........这里部分代码省略.........
开发者ID:admhome,项目名称:icqdesktop,代码行数:101,代码来源:MainPage.cpp


示例2: QWidget

DmWidget::DmWidget(QWidget *parent) :
    QWidget(parent)
{
    //installEventFilter(this);

    setObjectName("dmwidget");

    setStyleSheet("QWidget#dmwidget {padding-right: 90px; border-radius: 7px; background-color: rgba(55, 55, 55, 210); color: #fff; font-size: 15px;} QLineEdit { border-radius: 2px; background-color: rgba(55, 55, 55, 210); color: #fff; } QLabel { color: #fff;  } ");

    setMaximumSize(QSize(420, 320));

    setFixedSize(QSize(250, 80));


    QVBoxLayout *layout = new QVBoxLayout(this);
    QHBoxLayout *topLayout = new QHBoxLayout();
    QHBoxLayout *middleLayout = new QHBoxLayout();
    layout->addLayout(topLayout);
    layout->addLayout(middleLayout);

    m_wlTitle = new QLabel(this);
    m_wlTitle->setText("Ac/Dc - Back In Black");
    m_wlTitle->setStyleSheet("font-size: 12px;");
    m_wlTitle->setAlignment(Qt::AlignCenter);
    topLayout->addWidget(m_wlTitle);

    //middleLayout
    m_wlMb = new QLabel(this);
    m_wlMb->setStyleSheet("font-size: 10px;");
    m_wlMb->setText("5/25 Mb");
    middleLayout->addWidget(m_wlMb);

    m_wlQueue = new QLabel(this);
    m_wlQueue->setStyleSheet("font-size: 10px;");
    m_wlQueue->setText("In queue: 5");
    m_wlQueue->setAlignment(Qt::AlignRight);
    middleLayout->addWidget(m_wlQueue);

    m_wProgress = new QProgressBar(this);
    m_wProgress->setStyleSheet(":horizontal {border-radius: 0px; background: #BDBDBD;} ::chunk:horizontal { background: #000;}");
    m_wProgress->setFixedHeight(3);
    m_wProgress->setRange(0, 100);
    m_wProgress->setValue(25);
    layout->addWidget(m_wProgress);

    m_wbCancel = new StyledButton(tr("Cancel"), this);
    m_wbCancel->setFixedSize(50, 20);
    layout->addWidget(m_wbCancel);

    connect(m_wbCancel, SIGNAL(clicked()), this, SIGNAL(cancelAll()));
    connect(m_wbCancel, SIGNAL(clicked()), this, SLOT(onCancelAll()));



    //layout->addWidget(m_wList);

    hide();
    repaint();

    m_effect = new QGraphicsOpacityEffect(this);
    m_effect->setOpacity(0.0);

    setGraphicsEffect(m_effect);

    m_animation = new QPropertyAnimation(m_effect, "opacity");
    m_animation->setDuration(550);
}
开发者ID:Nerobrain,项目名称:pulsar,代码行数:67,代码来源:dmwidget.cpp


示例3: QMainWindow

BitcoinGUI::BitcoinGUI(QWidget *parent):
    QMainWindow(parent),
    clientModel(0),
    walletModel(0),
    encryptWalletAction(0),
    changePassphraseAction(0),
    unlockWalletAction(0),
    lockWalletAction(0),
    aboutQtAction(0),
    trayIcon(0),
    notificator(0),
    rpcConsole(0)
{
    setFixedSize(970, 550);
    setWindowTitle(tr("ClickCoin") + " - " + tr("Wallet"));
	qApp->setStyleSheet("QMainWindow { background-image:url(:images/bkg);border:none; } #frame { } QToolBar QLabel { padding-top:0px;padding-bottom:0px;spacing:10px; } #spacer { background:transparent;border:none; }  #toolbar2 { border:none;width:0px;hight:0px;padding-top:40px;padding-bottom:0px; } #toolbar { border:none;height:100%;padding-top:20px; background: #FFFFFF; text-align: center; color: black;min-width:80px;max-width:80px;} QToolBar QToolButton:hover {background-color:rgb(0,0,0));} QToolBar QToolButton { font-family:Century Gothic;padding-left:20px;padding-right:80px;padding-top:0px;padding-bottom:0px; width:100%; color: black; text-align: left; background-color: rgb(0,0,0) } #labelMiningIcon { padding-left:5px;font-family:Century Gothic;width:100%;font-size:10px;text-align:center;color:black; } QMenu { background: rgb(0,0,0); color:black; padding-bottom:10px; } QMenu::item { color:white; background-color: transparent; } QMenu::item:selected { background-color:rgb(0,0,0)); } QMenuBar { background: rgb(0,0,0); color:black; } QMenuBar::item { font-size:12px;padding-bottom:3px;padding-top:3px;padding-left:15px;padding-right:15px;color: black; background-color: white; } QMenuBar::item:selected { background-color:rgb(0,0,0)); }");
#ifndef Q_OS_MAC
    qApp->setWindowIcon(QIcon(":icons/bitcoin"));
    setWindowIcon(QIcon(":icons/bitcoin"));
#else
    setUnifiedTitleAndToolBarOnMac(true);
    QApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
#endif
    // Accept D&D of URIs
    setAcceptDrops(true);

    // Create actions for the toolbar, menu bar and tray/dock icon
    createActions();

    // Create application menu bar
    createMenuBar();

    // Create the toolbars
    createToolBars();

    // Create the tray icon (or setup the dock icon)
    createTrayIcon();

    // Create tabs
    overviewPage = new OverviewPage();

    transactionsPage = new QWidget(this);
    QVBoxLayout *vbox = new QVBoxLayout();
    transactionView = new TransactionView(this);
    vbox->addWidget(transactionView);
    transactionsPage->setLayout(vbox);

    addressBookPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::SendingTab);

    receiveCoinsPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::ReceivingTab);

    sendCoinsPage = new SendCoinsDialog(this);
    
    signVerifyMessageDialog = new SignVerifyMessageDialog(this);

    centralWidget = new QStackedWidget(this);
    centralWidget->addWidget(overviewPage);
    centralWidget->addWidget(transactionsPage);
    centralWidget->addWidget(addressBookPage);
    centralWidget->addWidget(receiveCoinsPage);
    centralWidget->addWidget(sendCoinsPage);
    setCentralWidget(centralWidget);

  

    // Status bar notification icons
    labelEncryptionIcon = new QLabel();
	labelStakingIcon = new QLabel();
    labelConnectionsIcon = new QLabel();
    labelBlocksIcon = new QLabel();
	
	if (GetBoolArg("-staking", true))
    {
        QTimer *timerStakingIcon = new QTimer(labelStakingIcon);
        connect(timerStakingIcon, SIGNAL(timeout()), this, SLOT(updateStakingIcon()));
        timerStakingIcon->start(30 * 1000);
        updateStakingIcon();
    }

    // Progress bar and label for blocks download
    progressBarLabel = new QLabel();
    progressBarLabel->setVisible(false);
    progressBar = new QProgressBar();
    addToolBarBreak(Qt::LeftToolBarArea);
    QToolBar *toolbar2 = addToolBar(tr("Tabs toolbar"));
    addToolBar(Qt::LeftToolBarArea,toolbar2);
    toolbar2->setOrientation(Qt::Vertical);
    toolbar2->setMovable( false );
    toolbar2->setObjectName("toolbar2");
    toolbar2->setFixedWidth(28);
    toolbar2->setIconSize(QSize(28,54));
	toolbar2->addWidget(labelEncryptionIcon);
	toolbar2->addWidget(labelStakingIcon);
    toolbar2->addWidget(labelConnectionsIcon);
    toolbar2->addWidget(labelBlocksIcon);
	toolbar2->setStyleSheet("#toolbar2 QToolButton { background: transparent;border:none;padding:0px;margin:0px;height:54px;width:28px; }");

    syncIconMovie = new QMovie(":/movies/update_spinner", "mng", this);

    // Clicking on a transaction on the overview page simply sends you to transaction history page
//.........这里部分代码省略.........
开发者ID:Toweliecoins,项目名称:ClickCoin,代码行数:101,代码来源:bitcoingui.cpp


示例4: QGroupBox

WarehouseGroup::WarehouseGroup(QWidget *pParent, const char *pName) :
  QGroupBox(pParent)
{
  _selectedOnly = false;
  if (_x_preferences)
    if (_x_preferences->boolean("selectedSites"))
      _selectedOnly=true;
  
  if(pName)
    setObjectName(pName);

  _fixed = true;
  _selectedGroup = new QWidget(this);
  QButtonGroup * buttonGroup = new QButtonGroup(this);
  
  _all = new QRadioButton(tr("All Sites"), this);
  _all->setObjectName("_all");
  _site = new QLabel(tr("Site:"),this);
  _site->setObjectName("_site");
  _selected = new QRadioButton(tr("Selected:"), _selectedGroup);
  _selected->setObjectName("_selected");
	 
  if (!_selectedOnly)
  {
    _all->setChecked(TRUE);
    buttonGroup->addButton(_all);
    buttonGroup->addButton(_selected);
  }
  
  _warehouses = new WComboBox(_selectedGroup, "_warehouses");

  if(_selectedOnly)
  {
    QHBoxLayout *hLayout = new QHBoxLayout(_selectedGroup);
    hLayout->setContentsMargins(0, 0, 0, 0);
    hLayout->setSpacing(5);
    hLayout->addWidget(_site);
    hLayout->addWidget(_warehouses);
    hLayout->addStretch();
    _selectedGroup->setLayout(hLayout);
    
    QVBoxLayout *vLayout = new QVBoxLayout(this);
    vLayout->setContentsMargins(5, 5, 5, 5);
    vLayout->setSpacing(0);
    vLayout->addWidget(_selectedGroup);
    setLayout(vLayout);
    
    _all->hide();
    _selected->hide();
  }
  else
  {
    _site->hide();
    setFixedSize(false);
  }

  connect(_selected, SIGNAL(toggled(bool)), _warehouses, SLOT(setEnabled(bool)));
  connect(buttonGroup, SIGNAL(buttonClicked(int)), this, SIGNAL(updated()));
  connect(_warehouses, SIGNAL(newID(int)), this, SIGNAL(updated()));

  if (((_x_preferences) ? _x_preferences->value("PreferredWarehouse").toInt() : -1) != -1)
    _selected->setChecked(TRUE);

  setTabOrder(_all, _selected);
  setTabOrder(_selected, _warehouses);
  setTabOrder(_warehouses, _all);
  setFocusProxy(_all);
  
  if (_x_metrics)
  {
    if (!_x_metrics->boolean("MultiWhs"))
    {
      this->hide();
      setAll();
    }
  }
}
开发者ID:Wushaowei001,项目名称:xtuple-1,代码行数:77,代码来源:warehousegroup.cpp


示例5: QPixmapButton

 QPixmapButton(QWidget *parent, const QPixmap &first, const QPixmap &second)
     : QPushButton(parent), m_showFirst(true), m_first(first), m_second(second)
 {
     setFixedSize(m_first.size());
 }
开发者ID:FlavioFalcao,项目名称:qt-creator,代码行数:5,代码来源:targetselector.cpp


示例6: THWidgetBase

InviteWidget::InviteWidget(QStringList items,
                           QString gd, QWidget *parent)
    : THWidgetBase(parent)
{
    setAttribute(Qt::WA_DeleteOnClose);
    setFixedSize(250, 180);
    setTitleBarWidth(250);
    setWindowFlags(Qt::FramelessWindowHint | Qt::Tool);
    setWindowModality(Qt::ApplicationModal);
    bar->setBarButtons(HappyTitleBar::MinButtonHint);
    bar->setBarButtons(HappyTitleBar::MaxButtonHint);
    bar->setExtraButtonVisible(false);
    bar->setBarIcon(":res/happy.png");
    bar->setBarContent(cn("邀请成员列表"));
    connect(bar, &HappyTitleBar::signalClose, this, [=] () {
            this->close();
    });
    members = items;
    gdm = gd;
    QLabel *lab = new QLabel(cn("选择邀请对象(未筛选)"));
    lab->setFixedWidth(120);
    lab->setStyleSheet(QStringLiteral("font-family:微软雅黑;font:12px;color:white;"));
    QPushButton *pb = new QPushButton(cn("筛选"), this);
    pb->setFixedWidth(50);
    pb->setCheckable(true);
    QHBoxLayout *h1 = new QHBoxLayout();
    h1->setContentsMargins(0, 0, 0, 0);
    h1->addStretch(1);
    h1->addWidget(lab, 0, Qt::AlignCenter);
    h1->addWidget(pb, 0, Qt::AlignCenter);
    h1->addStretch(1);
    CheckList *list = new CheckList(this);
    QPushButton *confrim = new QPushButton(cn("确认"), this);
    confrim->setFixedWidth(50);
    QVBoxLayout *v = new QVBoxLayout(this);
    v->setContentsMargins(10, 35, 10, 15);
    v->addLayout(h1, 1);
    v->addWidget(list, 5);
    v->addWidget(confrim, 1, Qt::AlignCenter);

    QFile file;
    file.setFileName(":res/css/button2.css");
    if (file.open(QIODevice::ReadOnly))
    {
        QByteArray ba = file.readAll();
        pb->setStyleSheet(QTextCodec::codecForLocale()->toUnicode(ba));
        confrim->setStyleSheet(QTextCodec::codecForLocale()->toUnicode(ba));
    }
    file.close();
    file.setFileName(":res/css/list2.css");
    if (file.open(QIODevice::ReadOnly))
    {
        QByteArray ba = file.readAll();
        list->setStyleSheet(QTextCodec::codecForLocale()->toUnicode(ba));
    }
    file.close();

    // load data
    ConfigureData *conf = ConfigureData::getInstance();
    updateColor(conf->getColorIni("color1"), conf->getColorIni("color2"));
    list->setmyuid(conf->getUuid());

    connect(pb, &QPushButton::toggled,
            this, [=] (bool b) {
        QString str = cn("选择邀请对象(%1)");
        if (b)
        {
            QStringList selectList;
            QStringList items = gdm.split(";");
            for (QString str : members)
            {
                QStringList temp = str.split(":");
                if (temp.size() == 2)
                {
                    if (!items.contains(temp.last()))
                    {
                        selectList << str;
                    }
                }
            }
            list->addCheckItems(selectList);
            str = str.arg(cn("筛选"));
        }
        else
        {
            list->addCheckItems(members);
            str = str.arg(cn("未筛选"));
        }
        lab->setText(str);
    });
    connect(confrim, &QPushButton::clicked,
            this, [=] () {
        QString uids = list->checkedids();
        QStringList lst = uids.split(";");
        if (lst.size() <= 1)
        {
            MsgBox::ShowMsgBox(cn("提示"),
                               cn("没有选择"),
                               cn("确定"));
                return;
//.........这里部分代码省略.........
开发者ID:AlanHJ,项目名称:TogetherHappy,代码行数:101,代码来源:creategroup.cpp


示例7: 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            = "Arial";

    // 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 slighly 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());

//.........这里部分代码省略.........
开发者ID:DavidJohnstonCEO,项目名称:bitcoinxt,代码行数:101,代码来源:splashscreen.cpp


示例8: setFixedSize

void OamCanvas::setScale(unsigned z) {
  imageSize = 64 * z;
  setFixedSize(imageSize + frameWidth() * 2, imageSize + frameWidth() * 2);
  refresh();
}
开发者ID:CarterLi,项目名称:bsnes-plus,代码行数:5,代码来源:oam-viewer.cpp


示例9: QWidget


//.........这里部分代码省略.........
    int titleCopyrightVSpace    = 40;

    float fontFactor            = 1.0;
    float devicePixelRatio      = 1.0;
#if QT_VERSION > 0x050100
    devicePixelRatio = static_cast<QGuiApplication*>(QCoreApplication::instance())->devicePixelRatio();
#endif

    // define text to place
    QString titleText       = tr(PACKAGE_NAME);
    QString versionText     = QString("Version %1").arg(QString::fromStdString(FormatFullVersion()));
    QString copyrightText   = QString::fromUtf8(CopyrightHolders(strprintf("\xc2\xA9 %u-%u ", 2013, COPYRIGHT_YEAR)).c_str());
    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 > 176) {
        fontFactor = fontFactor * 176 / titleTextWidth;
    }

    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 too 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));
        const int x = pixmap.width()/devicePixelRatio-titleTextWidth-paddingRight;
        const int y = paddingTop+titleCopyrightVSpace;
        QRect copyrightRect(x, y, pixmap.width() - x - paddingRight, pixmap.height() - y);
        pixPaint.drawText(copyrightRect, Qt::AlignLeft | Qt::AlignTop | Qt::TextWordWrap, 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());

    subscribeToCoreSignals();
    installEventFilter(this);
}
开发者ID:FeatherCoin,项目名称:Feathercoin,代码行数:101,代码来源:splashscreen.cpp


示例10: VERBOSE

void VirtualKeyboardQt::SwitchLayout(const QString &lang)
{
    if (!m_parentEdit)
    {
        VERBOSE(VB_IMPORTANT, LOC_ERR + "No edit receiving output");
        reject();
        return;
    }

    QString language = lang.toLower();

    QString theme_file = QString("keyboard/%1_").arg(language);

    if (!loadThemedWindow("keyboard", theme_file))
    {
        VERBOSE(VB_GENERAL, LOC_WARN +
                QString("Cannot find layout for '%1'").arg(language));

        // cannot find layout so fallback to US English layout
        if (!loadThemedWindow("keyboard", "keyboard/en_us_"))
        {
            VERBOSE(VB_IMPORTANT, LOC_ERR +
                    "Cannot find layout for US English");

            reject();
            return;
        }
    }

    // get dialog size from keyboard_container area
    LayerSet *container = getContainer("keyboard_container");

    if (!container)
    {
        VERBOSE(VB_IMPORTANT, LOC_ERR +
                "Cannot find the 'keyboard_container' in your theme");

        reject();
        return;
    }

    m_popupWidth = container->GetAreaRect().width();
    m_popupHeight = container->GetAreaRect().height();
    setFixedSize(QSize(m_popupWidth, m_popupHeight));

    QWidget *pw = m_parentEdit;
    QWidget *tlw = pw->topLevelWidget();
    QRect pwg = pw->geometry();
    QRect tlwg = tlw->frameGeometry();

    QPoint newpos;

    PopupPositionQt preferredPos;
    if (m_parentEdit->inherits("MythLineEdit"))
    {
        MythLineEdit *par = (MythLineEdit *)m_parentEdit;
        preferredPos = par->getPopupPosition();
    }
    else if (m_parentEdit->inherits("MythRemoteLineEdit"))
    {
        MythRemoteLineEdit *par = (MythRemoteLineEdit *)m_parentEdit;
        preferredPos = par->getPopupPosition();
    }
    else if (m_parentEdit->inherits("MythComboBox"))
    {
        MythComboBox *par = (MythComboBox *)m_parentEdit;
        preferredPos = par->getPopupPosition();
    }
    else
    {
        preferredPos = VKQT_POSCENTERDIALOG;
    }

    if (preferredPos == VKQT_POSBELOWEDIT)
    {
        if (pw->mapTo(tlw, QPoint(0,pwg.height() + m_popupHeight + 5)).y()
                < tlwg.height())
        {
            newpos = QPoint(pwg.width() / 2 - m_popupWidth / 2, pwg.height() + 5);
        }
        else
        {
            newpos = QPoint(pwg.width() / 2 - m_popupWidth / 2, - 5 - m_popupHeight);
        }
    }
    else if (preferredPos == VKQT_POSABOVEEDIT)
    {
        if (pw->mapTo(tlw, QPoint(0, - m_popupHeight - 5)).y()
            > 0)
        {
            newpos = QPoint(pwg.width() / 2 - m_popupWidth / 2, - 5 - m_popupHeight);
        }
        else
        {
            newpos = QPoint(pwg.width() / 2 - m_popupWidth / 2, pwg.height() + 5);
        }
    }
    else if (preferredPos == VKQT_POSTOPDIALOG)
    {
        newpos = QPoint(tlwg.width() / 2 - m_popupWidth / 2, 5);
//.........这里部分代码省略.........
开发者ID:DocOnDev,项目名称:mythtv,代码行数:101,代码来源:virtualkeyboard_qt.cpp


示例11: QDialog

/////////////////////////////////////////////////////////////////////////////////////////////////
// Trade dialog class
/////////////////////////////////////////////////////////////////////////////////////////////////
CasinoDialog::CasinoDialog(const PlayerState* player, QWidget *parent, const char * name)
: QDialog(parent, name, true)
{

	unsigned int money = player->get_money();

	setCaption("Welcome to the Casino.");

//-----------------------------------------------------------------------------------------------
// Set up acceptance and rejection buttons
//-----------------------------------------------------------------------------------------------
		
		QPushButton *ok = new QPushButton ("Place your bet", this);
		ok->setGeometry( 110, 300, 215, 30);
		connect( ok, SIGNAL(clicked()), SLOT(accept()));

		
//-----------------------------------------------------------------------------------------------
// Set up frames for trading players
//-----------------------------------------------------------------------------------------------
		QLabel *avail = new QLabel ( QString("Available Money:  $") + QString::number(money), this);
		avail->setGeometry( 130, 170, 205, 30);
		
		QLabel *betLabel = new QLabel ( "Place Your Bet:", this);
		betLabel->setGeometry( 130, 200, 205, 30);

		_spin = new QSpinBox( (money < 100 ? money : 100) , money, 100, this, "_spin");
		_spin->setGeometry(230, 205, 50, 20);

//-----------------------------------------------------------------------------------------------
// Set up property check boxes for first player
//-----------------------------------------------------------------------------------------------
		QRadioButton *Prop1, *Prop2, *Prop3, *Prop4, *Prop5;

		Prop1 = new QRadioButton( "Any Craps: wins on a throw of 2, 3 or 12 with a payoff of 8:1", this);
		Prop1->setGeometry( 5, 0, 400, 30);

		Prop2 = new QRadioButton( "Any Seven: wins on a throw of 7 with a payoff of 5:1", this);
		Prop2->setGeometry( 5, 25, 400, 30);

		Prop3 = new QRadioButton( "Eleven: wins on a throw of 11 with a payoff of 16:1", this);
		Prop3->setGeometry( 5, 50, 400, 30);

		Prop4 = new QRadioButton( "Ace Duece: wins on a throw of 3 with a payoff of 16:1", this);
		Prop4->setGeometry( 5, 75, 400, 30);

		Prop5 = new QRadioButton( "Aces or Boxcars: wins on a throw of 2 or 12 with a payoff of 30:1", this);
		Prop5->setGeometry( 5, 100, 410, 30);

		_group = new QButtonGroup(this);
		_group->setGeometry(0, 0, 0, 0);
		
		// type = kCCraps, kCSeven, kCEleven, kCDuece, kCAorB
		_group->insert(Prop1,0); // any craps
		_group->insert(Prop2,1); // any seven
		_group->insert(Prop3,2); // eleven
		_group->insert(Prop4,3); // ace duece
		_group->insert(Prop5,4); // aces or boxcars

		setFixedSize(420,335);
}
开发者ID:kylegibson,项目名称:yloponom,代码行数:64,代码来源:CasinoDialog.C


示例12: QWidget

/**
 * @brief Constructor for the GameBoard class sets the Central Widget of the MainWindow to the game board.
 * @param parent Central Widget
 * @param jellies_speed the speed of the jellies
 * @param lvl game level
 * */
GameBoard::GameBoard(QWidget *parent, size_t jellies_speed, unsigned int lvl) :
    QWidget(parent),
    ui(new Ui::GameBoard), jellies_speed(jellies_speed), level(lvl)
{
    ui->setupUi(this);

    // Create the top widget, that will
    Top = new QWidget;
    // This code creates the Top bar
    // Level: #      Timer: #

    Top->setFixedSize(450,40);
    // set style of the top bar
    Top->setStyleSheet("QLabel{ font-family: Odin Rounded; font-size: 18px; color: white; }");

    // Create the top bar
    QHBoxLayout *top_bar = new QHBoxLayout(Top);
    // top_bar layout is used to space the elements from the Top Widget and the _Board Widget.
    // Level: #
    QLabel* level_text = new QLabel("Level: ");
    level_value = new QLabel(QString::number(level)); // level is either 1, 2 or 3
    // Add the level widgets to the Top bar
    top_bar->addWidget(level_text);
    top_bar->addWidget(level_value);
    // Add in horizontal space before the next labels
    QSpacerItem* horizontal_space = new QSpacerItem(200,10);
    // Add the horizontal space to the top_bar layout
    top_bar->addSpacerItem(horizontal_space);

    // Level: #      Timer: #
    QLabel* time_text = new QLabel("Timer: ");
    time_value = new QLabel(QString::number(0)); // start at 0 seconds

    top_bar->addWidget(time_text);
    top_bar->addWidget(time_value);

    // Create the Board
    Board = new QWidget;
    Board->setFixedSize(450,450);

    // Now we piece everything together
    // Central Widget is composed of Top and Board
    //    Top
    // --------
    //   Board

    // Do not allow board to be resized, otherwise spacings get messed up
    setFixedSize(550,550);

    // Create a vertical box layout for the two pieces
    QVBoxLayout *piece_together = new QVBoxLayout;

    piece_together->addWidget(Top,0,Qt::AlignCenter);
    piece_together->addWidget(Board,0,Qt::AlignCenter);

    QPushButton* quit = new QPushButton("Quit");
    quit->setFixedSize(450, 30);
    QObject::connect(quit, SIGNAL(clicked()), parent, SLOT(game_over()));

    piece_together->addWidget(quit,0,Qt::AlignCenter);

    this->setLayout(piece_together);

    // **************** Everything is now pieced together ******************************

    // **************** We now draw the user box and the angry jellies **************

    // Set user box position to be in the middle of the larger square
    x_player_jelly = 155;
    y_player_jelly = 155;
    // Number of colored jellies
    number_jellies = 4;
    x_jellies = new double[number_jellies];
    y_jellies = new double[number_jellies];
    width_jellies = new double[number_jellies] ;
    height_jellies = new double[number_jellies];
    // Set first jelly size and starting positions
    x_jellies[0] = 220.0;
    y_jellies[0] = 280.0;
    width_jellies[0] = 60.0;
    height_jellies[0] = 50.0;
    // Set second jelly size and starting positions
    x_jellies[1] = 250.0;
    y_jellies[1] = 10.0;
    width_jellies[1] = 100.0;
    height_jellies[1] = 40.0;
    // Set third jelly size and starting positions
    x_jellies[2] = 20.0;
    y_jellies[2] = 20.0;
    width_jellies[2] = 30.0;
    height_jellies[2] = 60.0;
    // Set fourth jelly size and starting positions
    x_jellies[3] = 20.0;
    y_jellies[3] = 270.0;
//.........这里部分代码省略.........
开发者ID:cup-roc,项目名称:Angry-Jellies,代码行数:101,代码来源:gameboard.cpp


示例13: setWindowTitle

Klavishi::Klavishi(QWidget*parent)
:QWidget(parent)
{

setWindowTitle("RDM-11");// выбираем название окна
setFixedSize(490,240); // устанавливаем размер окна
//setStyleSheet(AlignHCenter);
//setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
setAutoFillBackground(true);

akkum = new QProgressBar;
akkum->setFixedSize(60,15);
akkum->setValue(24);

label = new QLabel("11:16 23.05.2013");

picture.load(":/im/image1.jpg");

picture_multichannel.load(":/im/imag.jpg");
picture_singlechannel.load(":/im/ima.jpg");


handle =new QPushButton(tr("Настройки"));// делаем кнопку для калибровки
handle->setIcon(picture);
handle->setIconSize(picture.size());
translator =new QTranslator;

multichannel = new QPushButton(tr("Сплошной режим")); // делаем кнопку для многоканального
multichannel->setIcon(picture_multichannel);
multichannel->setIconSize(picture_multichannel.size());

singlechannel = new QPushButton(tr("Одноканальный")); // делаем кнопку для
singlechannel->setIcon(picture_singlechannel);
singlechannel->setIconSize(picture_singlechannel.size());

frame_handle = new QFrame;
frame_multichannel = new QFrame;
frame_singlechannel = new QFrame;
frame_akkum =new QFrame;

connect(handle,SIGNAL(clicked()),SLOT(handle_channel()));
connect(multichannel,SIGNAL(clicked()),SLOT(multi_channel()));
connect(singlechannel,SIGNAL(clicked()),SLOT(single_channel()));
//pal_1.setBrush(QPalette::Background,Qt::white);

//frame_handle->setPalette(pal_1);
frame_handle->setAutoFillBackground(true);
frame_handle->setFixedSize(170,120);
frame_handle->setLayout(new QVBoxLayout());
frame_handle->layout()->addWidget(handle);
//frame_handle->layout()->addWidget(label);


frame_akkum->setAutoFillBackground(true);
frame_akkum->setFixedSize(150,40);
frame_akkum->setLayout(new QHBoxLayout());
frame_akkum->layout()->addWidget(akkum);
frame_akkum->layout()->addWidget(label);

//frame_multichannel->setPalette(pal_1);
frame_multichannel->setAutoFillBackground(true);
frame_multichannel->setFixedSize(250,120);
frame_multichannel->setLayout(new QVBoxLayout());
frame_multichannel->layout()->addWidget(multichannel);

//frame_singlechannel->setPalette(pal_1);
frame_singlechannel->setAutoFillBackground(true);
frame_singlechannel->setLayout(new QVBoxLayout());
frame_singlechannel->setFixedSize(190,120);
frame_singlechannel->layout()->addWidget(singlechannel);

translator =new QTranslator;
QVBoxLayout * mainLayout  = new QVBoxLayout;
mainLayout->setMargin(0);
mainLayout->setSpacing(0);
mainLayout->addSpacing(-50);

QHBoxLayout * phbxLayout = new QHBoxLayout;
phbxLayout->setMargin(0);
phbxLayout->addSpacing(0);

QHBoxLayout * layout_handle=new QHBoxLayout;
layout_handle->addWidget(frame_handle);
layout_handle->setAlignment(Qt::AlignLeft);



QHBoxLayout * layout_multichannel=new QHBoxLayout;
layout_multichannel->addWidget(frame_multichannel);
layout_multichannel->setAlignment(Qt::AlignCenter);
//layout_multichannel->addStretch(0);


QHBoxLayout *layout_singlechannel=new QHBoxLayout;
layout_singlechannel->addWidget(frame_singlechannel);
layout_singlechannel->setAlignment(Qt::AlignRight);



QHBoxLayout * layout_akkum = new QHBoxLayout;
//.........这里部分代码省略.........
开发者ID:Sedom91,项目名称:interface_rdm_11,代码行数:101,代码来源:klavishi.cpp


示例14: setFixedSize

void GUIView::initialize() {
    setFixedSize(840, 700);
    setWindowTitle("GUIView");

    srcRect.setRect(0,0,640,480);
    frontCameraRect.setRect(0,0,320,240);
    downCameraRect.setRect(320,0,320,240);

    //frontCameraImage = QImage(":/img/MDA.jpg");

    //Creating an image that holds a gradient of blue

    //Create an image to be painted on
    QImage sub(640,480,QImage::Format_RGB32);

    //Setup the painter to paint/draw on the image
    QPainter subImgPainter;
    subImgPainter.begin(&sub); //Paint on that image

    //Create the gradient
    QLinearGradient blueGradient(0,0,640,480);

    //Set the starting color and end colors
    blueGradient.setColorAt(0.0,QColor(62,58,200));// 0.0 is start position as a qreal
    blueGradient.setColorAt(1.0,QColor(175,80,255)); //1.0 is end position as a qreal

    //Create a brush from the gradient (to paint with)
    QBrush blueGradientBrush(blueGradient);

    //Use the brush
    //subImgPainter.fillRect(sub.rect(), blueGradientBrush);
    //subImgPainter.end();

    downCameraImage = sub;

    // Show Case View Widget initialization
    powerStatus = new QLabel("Power: Off");
    powerButton = new QPushButton("Turn Power On/Off");
    powerButton->setCheckable(true);
    motorButton = new QPushButton("Turn Motors On");

    movement = new QLabel("Movement");
    leftButton = new QPushButton("Veer Left");
    rightButton = new QPushButton("Veer right");

    forwardButton = new QPushButton("Move Forward");
    backwardButton = new QPushButton("Move Backward");
    sinkButton = new QPushButton("Sink");
    riseButton = new QPushButton("Rise");
    stopButton = new QPushButton("Stop");

    specialActions = new QLabel("Special Actions");
    surfaceButton = new QPushButton("Surface");
    gateButton = new QPushButton("Gate Task");
    pathButton = new QPushButton("Path Task");

    systemActions = new QLabel("System Actions");
    menuButton = new QPushButton("Menu");
    exitButton = new QPushButton("Exit");

    depthReading = new QLabel("Depth:");
    yawReading = new QLabel("Yaw:");

    targetDepthLabel = new QLabel("Target:");
    targetYawLabel = new QLabel("Target:");

    // Show Case View layouts
    QVBoxLayout *verticalLayout = new QVBoxLayout();
    QHBoxLayout *mainLayout = new QHBoxLayout(this);
    QGridLayout *readingsLayout = new QGridLayout();

    //Show Case view Widget Positioning
    //Down want to add rects from view to layout
    //What to do? : set other BoxLayouts and add spacing?

    verticalLayout->addWidget(powerStatus);
    verticalLayout->addWidget(powerButton);
    verticalLayout->addWidget(motorButton);
    verticalLayout->addSpacing(10);

    verticalLayout->addWidget(movement);
    verticalLayout->addWidget(leftButton);
    verticalLayout->addWidget(rightButton);
    verticalLayout->addWidget(sinkButton);
    verticalLayout->addWidget(riseButton);
    verticalLayout->addWidget(forwardButton);
    verticalLayout->addWidget(backwardButton);
    verticalLayout->addWidget(stopButton);
    verticalLayout->addSpacing(10); //Spacing size of 20 pixels

    verticalLayout->addWidget(specialActions);
    verticalL 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ setFlag函数代码示例发布时间:2022-05-30
下一篇:
C++ setFixedHeight函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap