当前位置: 首页>>代码示例>>C++>>正文


C++ QPushButton::resize方法代码示例

本文整理汇总了C++中QPushButton::resize方法的典型用法代码示例。如果您正苦于以下问题:C++ QPushButton::resize方法的具体用法?C++ QPushButton::resize怎么用?C++ QPushButton::resize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QPushButton的用法示例。


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

示例1: Layer

Controllers::Controllers(QGraphicsItem *parent) :
    Layer(parent),
    m_boundingRect(0,0,0,0)
{
    setFlag(QGraphicsItem::ItemHasNoContents);
    textItem = new QGraphicsTextItem(this);
    textItem->setPos(0,0);
    textItem->setDefaultTextColor(Qt::green);
    textItem->setZValue(1000);

    QPushButton * btPlus = new QPushButton("+");
    QPushButton * btMinus = new QPushButton("-");
    btPlus->resize(50,50);
    btMinus->resize(50,50);
    plusButtomItem =  new QGraphicsProxyWidget(this);
    minusButtomItem = new QGraphicsProxyWidget(this);
    plusButtomItem->setWidget(btPlus);
    minusButtomItem->setWidget(btMinus);

    plusButtomItem->setPos(10, 50);
    minusButtomItem->setPos(10,110);

    connect(btPlus, SIGNAL(clicked()), this, SLOT(onPlusPressed()));
    connect(btMinus, SIGNAL(clicked()), this, SLOT(onMinusPressed()));
}
开发者ID:,项目名称:,代码行数:25,代码来源:

示例2: main

int main ( int argc, char *argv[] )
{
    QApplication app ( argc, argv );
    QPushButton hello ( "Hello world" );
    hello.resize ( 100, 30 );
    hello.show ();
    return app.exec ();
}
开发者ID:pombredanne,项目名称:anacrolix,代码行数:8,代码来源:test.cpp

示例3: CreateMsgButton

void CreateMsgButton(QMainWindow* window)
{
	QMessageBox* message = new QMessageBox(window);
	message->setText("Message text");
  
  	QPushButton* button = new QPushButton("Message", window);
	button->move(85, 40);
	button->resize(80, 25);
	button->show();
  	QObject::connect(button, SIGNAL(released()), message, SLOT(exec()));
}
开发者ID:DouglasAllen,项目名称:C-Programming-Refference,代码行数:11,代码来源:main.cpp

示例4: egx_pushbutton_create_

egx_wnd_t egx_pushbutton_create_(int res_id,char *name,egx_uint32_t style,int x,int y,int width,int height,egx_wnd_t parent)
{
	QPushButton *button = new QPushButton((QWidget*)(parent));
	button->setText(QString::fromLocal8Bit(name));
	if(x == 0 || y == 0){
		button->resize(width,height);
	}else{
		button->setGeometry(x,y,width,height);
	}
	return HWND_TO_GUIWND(button);
}
开发者ID:edgarliu,项目名称:easygx,代码行数:11,代码来源:easygx_control_.cpp

示例5: updateImage

void RunGame::updateImage()
{
    // 获得 widget 的大小
    int widgetWidth = ui->widget->width();
    int widgetHeight = ui->widget->height();

    // 获得图片可能的尺寸
    int imageWidth = widgetWidth / m_colNumber;
    int imageHeight = widgetHeight / m_rowNumber;

    // 使用最小的尺寸
    if (imageWidth > imageHeight)
    {
        imageWidth = imageHeight;
    }
    imageHeight = imageWidth;

    // 获得top与left坐标
    int x = (widgetWidth - imageWidth * m_colNumber) / 2;
    int y = (widgetHeight - imageHeight * m_rowNumber) / 2;

    m_imageBtnWidth = imageWidth;
    m_imageBtnHeight = imageHeight;
    m_imageBtnTop = y;
    m_imageBtnLeft = x;

    for (int i = 0; i < m_colNumber; i++)
    {
        for (int j = 0; j < m_rowNumber; j++)
        {
            int value = m_core.GetCell(j+1, i+1);
            if (CELL_NO_HAS_IMAGE != value)
            {
                QPushButton * btn = m_imageBtns[j*m_colNumber + i];
                btn->setFocusPolicy(Qt::NoFocus);
                btn->resize(QSize(imageWidth, imageHeight));
                btn->move(x + imageWidth * i, y + imageHeight * j);

                btn->setProperty(BTN_IMAGE_VALUE, value);
                QPixmap image;
                QString imageFile = QString("%1.png").arg(value);
                image.load(m_imageFileFamily + imageFile);
                btn->setIcon(image);
                btn->setIconSize(QSize(imageWidth - 6, imageHeight - 6));
                btn->show();
                connect(btn, SIGNAL(clicked()), this, SLOT(on_btn_image_clicked()));
            }
        }
    }

}
开发者ID:JiabaoZhu,项目名称:PictureMatch,代码行数:51,代码来源:RunGame.cpp

示例6: main

int main(int argc, char *argv[])
{
  QApplication app(argc, argv);
//-----------------------
           QWidget MainWindows;
           MainWindows.setStyleSheet(
                                                    " QWidget   { font-size: 17px;  color :#65ED64; background-color: #777777;  border: 7px solid #64EB8D; }"
                                                  );
//-----------------------

           QLabel      *ptLabel         = new QLabel(&MainWindows);
           QPushButton *ptButton    = new QPushButton(&MainWindows);
           Counter     counter;

  ptLabel->move(25,25);
  ptLabel->setText(" T");
  ptLabel->resize(150,150);
  ptLabel->setStyleSheet(
                              "QLabel   { font-size: 80px;  color :#65ED64; background-color: #0C9F1D;  border: 7px solid #64EB8D; }"
                              );

  ptButton->move(180,25);
  ptButton->setText("  Add   ");
   ptButton->resize(150,150);
  ptButton->setStyleSheet(
                            "QPushButton   { font-size: 40px;  color :#65ED64; background-color: #0C9F1D;  border: 7px solid #64EB8D; }"
                             );
//  label.show();
//  button.show();

  QObject::connect(ptButton, SIGNAL(clicked()),
                   &counter, SLOT(slotInc())
                   );
  QObject::connect(&counter, SIGNAL(counterChanged(int)),
                   ptLabel, SLOT(setNum(int))
                   );
  QObject::connect(&counter, SIGNAL(goodbye()),
                   &app, SLOT(quit())
                   );

MainWindows.resize(350, 200);
MainWindows.show();

  return app.exec();
}
开发者ID:disgraceful,项目名称:cpp-kpzFULL,代码行数:45,代码来源:main.cpp

示例7: do_something

void ctkExampleDicomAppLogic::do_something()
{
  QPushButton *button = new QPushButton("Button from App");
  try
  {
    QRect preferred(50,50,100,100);
    qDebug() << "  Asking:getAvailableScreen";
    QRect rect = host->getAvailableScreen(preferred);
    qDebug() << "  got sth:" << rect.top();
    button->move(rect.topLeft());
    button->resize(rect.size());
  }
  catch (const std::runtime_error& e)
  {
    qCritical() << e.what();
  }
  button->show();
}
开发者ID:gokhanuzunbas,项目名称:CTK,代码行数:18,代码来源:ctkExampleDicomAppLogic.cpp

示例8: main

//! [0]
int main(int argc, char **argv)
{
    QApplication app(argc, argv);
    QPushButton button;
    QStateMachine machine;
//! [0]

//! [1]
    QState *off = new QState();
    off->assignProperty(&button, "text", "Off");
    off->setObjectName("off");

    QState *on = new QState();
    on->setObjectName("on");
    on->assignProperty(&button, "text", "On");
//! [1]

//! [2]
    off->addTransition(&button, SIGNAL(clicked()), on);
    on->addTransition(&button, SIGNAL(clicked()), off);
//! [2]

//! [3]
    machine.addState(off);
    machine.addState(on);
//! [3]

//! [4]
    machine.setInitialState(off);
    machine.start();
//! [4]

//! [5]
#if defined(Q_OS_SYMBIAN)
    button.showMaximized();
#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_SIMULATOR)
    button.show();
#else
    button.resize(100, 50);
    button.show();
#endif
    return app.exec();
}
开发者ID:Kwangsub,项目名称:qt-openwebos,代码行数:44,代码来源:main.cpp

示例9: main

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    //luncher w;
    //w.show();

    QPushButton quit ("Quit");

    quit.resize(130,80);

    quit.setFont(QFont("Comic Sans Ms",15, QFont::Bold , QFont::italic()));

    QObject::connect(&quit , SIGNAL(clicked()), &a, SLOT(quit()));


    quit.show();

    
    return a.exec(); //code retour de l'application. nécessaire
}
开发者ID:Vanskjaere,项目名称:cpp_training,代码行数:20,代码来源:main.cpp

示例10: QPushButton

// add a button
QPushButton *
QTACDraw::addButton (QString text)
{
    QFont fnt;
    QPushButton *btn;
    QString stylesheet;

    stylesheet =
        "background: transparent; border: 1px solid transparent;border-color: darkgray;";

    btn = new QPushButton (text, this);
    btn->resize (button_width, button_height);
    fnt = btn->font ();
    fnt.setPixelSize (16);
    fnt.setBold (true);
    btn->setFont (fnt);
    btn->setStyleSheet (stylesheet);
    btn->setAutoFillBackground (false);
    btn->setFocusPolicy (Qt::NoFocus);
    Button += btn;
    return btn;
}
开发者ID:sophonia101,项目名称:freechartgeany,代码行数:23,代码来源:qtachart_draw.cpp

示例11: tabButton

// QTabBar::setTabButton(index, closeSide, closeButton);
void tst_QTabBar::tabButton()
{
    QFETCH(QTabBar::ButtonPosition, position);
    QTabBar::ButtonPosition otherSide = (position == QTabBar::LeftSide ? QTabBar::RightSide : QTabBar::LeftSide);

    QTabBar tabbar;
    tabbar.resize(500, 200);
    tabbar.show();
    QTRY_VERIFY(tabbar.isVisible());

    tabbar.setTabButton(-1, position, 0);
    QVERIFY(tabbar.tabButton(-1, position) == 0);
    QVERIFY(tabbar.tabButton(0, position) == 0);

    tabbar.addTab("foo");
    QCOMPARE(tabbar.count(), 1);
    tabbar.setTabButton(0, position, 0);
    QVERIFY(tabbar.tabButton(0, position) == 0);

    QPushButton *button = new QPushButton;
    button->show();
    button->setText("hi");
    button->resize(10, 10);
    QTRY_VERIFY(button->isVisible());
    QTRY_VERIFY(button->isVisible());

    tabbar.setTabButton(0, position, button);

    QCOMPARE(tabbar.tabButton(0, position), static_cast<QWidget *>(button));
    QTRY_VERIFY(!button->isHidden());
    QVERIFY(tabbar.tabButton(0, otherSide) == 0);
    QCOMPARE(button->parent(), static_cast<QObject *>(&tabbar));
    QVERIFY(button->pos() != QPoint(0, 0));

    QPushButton *button2 = new QPushButton;
    tabbar.setTabButton(0, position, button2);
    QVERIFY(button->isHidden());
}
开发者ID:maxxant,项目名称:qt,代码行数:39,代码来源:tst_qtabbar.cpp

示例12: main

//! [0]
int main(int argc, char **argv)
{
    QApplication app(argc, argv);
    QPushButton button;
    QStateMachine machine;
//! [0]

//! [1]
    QState *off = new QState();
    off->assignProperty(&button, "text", "Off");
    off->setObjectName("off");

    QState *on = new QState();
    on->setObjectName("on");
    on->assignProperty(&button, "text", "On");
//! [1]

//! [2]
    off->addTransition(&button, SIGNAL(clicked()), on);
    on->addTransition(&button, SIGNAL(clicked()), off);
//! [2]

//! [3]
    machine.addState(off);
    machine.addState(on);
//! [3]

//! [4]
    machine.setInitialState(off);
    machine.start();
//! [4]

//! [5]
    button.resize(100, 50);
    button.show();
    return app.exec();
}
开发者ID:elProxy,项目名称:qtbase,代码行数:38,代码来源:main.cpp

示例13: initLayout

void CConfigJogDialog::initLayout(void)
{
    static const char *strLut[] = {
        "JointVelocity",
        "JointAcceleration",
        "ServoVelocity",
        "ServoAcceleration",
        "LinearVelocity",
        "LinearAcceleration",
        "VelocityRatio"
    };
    static const char *unitLut[] = {
        "°/s",
        "°/(s·s)",
        "°/s",
        "°/(s·s)",
        "mm/s",
        "mm/(s·s)",
        "%"
    };
    static const char *toolTipLut[] = {
        "Velocity of single joint",
        "Acceleration of single joint",
        "Velocity of the servo",
        "Acceleration of the servo",
        "Velocity of single axis",
        "Acceleration of single axis",
        "Ratio of the velocity"
    };

    QFont font("微软雅黑", 8);

    COptions::JogParams jogParams;
    COptions::instance()->getJogParams(&jogParams);
    float *params = (float *)&jogParams;

    int i = 0;
    for (i = 0; i < 6; i++) {
        QLabel *label = new QLabel(this);
        label->move(10, 10 + i * 40);
        label->resize(150, 30);
        label->setFont(font);
        label->setText(strLut[i]);

        QLineEdit *lineEdit = new QLineEdit(this);
        lineEdit->move(180, 10 + i * 40);
        lineEdit->resize(100, 30);
        lineEdit->setFont(font);
        lineEdit->setToolTip(toolTipLut[i]);
        lineEdit->setText(QString("%1").arg(params[i]));
        paramWidgetList << lineEdit;

        label = new QLabel(this);
        label->move(300, 10 + i * 40);
        label->resize(50, 20);
        label->setFont(font);
        label->setText(unitLut[i]);
    }

    QPushButton *sendBtn = new QPushButton(this);
    sendBtn->move(280, 10 + i * 40);
    sendBtn->resize(120, 50);
    sendBtn->setFont(font);
    sendBtn->setText("Send");
    connect(sendBtn, SIGNAL(clicked()), this, SLOT(onSendBtnClicked()));
}
开发者ID:DobotTeam,项目名称:Dobot_for_Developers,代码行数:66,代码来源:CConfigJogDialog.cpp

示例14: RebuildEditView

void AvatarEditor::RebuildEditView()
{
    if (!avatar_widget_)
        return;

    // Activate/deactivate export button based on whether export currently supported
    QPushButton *button = avatar_widget_->findChild<QPushButton *>("but_export");
    if (button)
        button->setEnabled(rexlogicmodule_->GetAvatarHandler()->AvatarExportSupported());

    QWidget* mat_panel = avatar_widget_->findChild<QWidget *>("panel_materials");
    QWidget* attachment_panel = avatar_widget_->findChild<QWidget *>("panel_attachments");
    if (!mat_panel || !attachment_panel)
        return;

    Scene::EntityPtr entity = rexlogicmodule_->GetAvatarHandler()->GetUserAvatar();
    if (!entity)
        return;
    EC_AvatarAppearance* appearance = entity->GetComponent<EC_AvatarAppearance>().get();
    if (!appearance)
        return;

    int width = 308-10;
    int tab_width = 302-10;
    int itemheight = 20;

    // Materials
    ClearPanel(mat_panel);
    const AvatarMaterialVector& materials = appearance->GetMaterials();
    mat_panel->resize(width, itemheight * (materials.size() + 1));

    for (uint y = 0; y < materials.size(); ++y)
    {
        QPushButton* button = new QPushButton("Change", mat_panel);
        button->setObjectName(QString::fromStdString(ToString<int>(y))); // Material index
        button->resize(50, 20);
        button->move(width - 50, y*itemheight);
        button->show();

        QObject::connect(button, SIGNAL(clicked()), this, SLOT(ChangeTexture()));
        // If there's a texture name, use it, because it is probably more understandable than material name
        std::string texname = materials[y].asset_.name_;
        if (materials[y].textures_.size())
            texname = materials[y].textures_[0].name_;

        QLabel* label = new QLabel(QString::fromStdString(texname), mat_panel);
        label->resize(200,20);
        label->move(0, y*itemheight);
        label->show();
    }

    // Attachments
    ClearPanel(attachment_panel);
    const AvatarAttachmentVector& attachments = appearance->GetAttachments();
    attachment_panel->resize(width, itemheight * (attachments.size() + 1));

    for (uint y = 0; y < attachments.size(); ++y)
    {
        QPushButton* button = new QPushButton("Remove", attachment_panel);
        button->setObjectName(QString::fromStdString(ToString<int>(y))); // Attachment index
        button->resize(50, 20);
        button->move(width - 50, y*itemheight);
        button->show();

        QObject::connect(button, SIGNAL(clicked()), this, SLOT(RemoveAttachment()));

        std::string attachment_name = attachments[y].name_;
        // Strip away .xml from the attachment name for slightly nicer display
        std::size_t pos = attachment_name.find(".xml");
        if (pos != std::string::npos)
            attachment_name = attachment_name.substr(0, pos);

        QLabel* label = new QLabel(QString::fromStdString(attachment_name), attachment_panel);
        label->resize(200,20);
        label->move(0, y*itemheight);
        label->show();
    }

    // Modifiers
    QTabWidget* tabs = avatar_widget_->findChild<QTabWidget *>("tab_appearance");
    if (!tabs)
        return;
    for (;;)
    {
        QWidget* tab = tabs->widget(0);
        if (!tab)
            break;
        tabs->removeTab(0);
        delete tab;
    }

    const MasterModifierVector& master_modifiers = appearance->GetMasterModifiers();
    // If no master modifiers, show the individual morph/bone controls
    if (!master_modifiers.size())
    {
        QWidget* morph_panel = GetOrCreateTabScrollArea(tabs, "Morphs");
        QWidget* bone_panel = GetOrCreateTabScrollArea(tabs, "Bones");
        if (!morph_panel || !bone_panel)
            return;

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

示例15: Pal

Piano::Piano(QWidget *parent) :
    QWidget(parent)
{
    init_log();
    QPalette Pal(palette());
    Pal.setColor(QPalette::Background, QColor::fromRgb(240, 240, 240));
    setAutoFillBackground(true);
    setPalette(Pal);

    showing = false; //displaying the scorebox

    b_names_dip = false;
    b_racc_disp = false;
    notes = new QVector<Touche*>();
    notes_jouees = new QVector<QString>();
    setFixedSize(800, 310);

    QPushButton *raccButt= new QPushButton(QString(""),this);
    raccButt->setToolTip(QString("Affiche les raccourcis clavier pour le piano"));
    QPushButton *noteNames = new QPushButton(QString(""),this);
    noteNames->setToolTip(QString("Affiche le nom des notes sur le piano"));

    QCheckBox *checkB = new QCheckBox(QString("options affichage"),this);
    checkB->setToolTip(QString("Affiche/cache les options d'affiche du piano"));
    QPushButton *retour = new QPushButton(QString(""),this);
    checkB->setChecked(true);
    retour->move(740,0);
    retour->setStyleSheet("border-image: url(:/new/prefix1/undo.png)");
    retour->setToolTip(QString("Annule la dernière note jouée"));
    retour->resize(50,50);
    QPushButton *solution = new QPushButton(QString("Solution"),this);
    solution->setToolTip(QString("Aide: Indique la note suivante sur le piano"));
    solution->move(0,10);
    checkB->move(0,282);
    Touche* doM = new Touche(this, QString("tab"),QString("Do"));
    int sizeT= 38;//doM->width();
    //QMessageBox::information(new QWidget(),QString("taille "),QString::number(sizeT));

    int hauteur = 100;
    int nT =3;
    raccButt->move(0,hauteur+50);
    raccButt->setFixedSize(140,50);
    raccButt->setStyleSheet("border-image: url(:/img/clavier.svg.png);"
                            );



    noteNames->move(660,hauteur +50);
    noteNames->setFixedSize(140,50);
    noteNames->setStyleSheet("border-image: url(:/img/doremi);"
                            "border-width: 2px;");

    doM->move(sizeT*nT,hauteur);
    nT+=1;
    Touche* reM = new Touche(this, QString("A"),QString("Ré"));
    reM->move(sizeT*nT,hauteur);
    nT+=1;
    Touche* miM = new Touche(this, QString("Z"),QString("Mi"));
    miM->move(sizeT*nT,hauteur);
    nT+=1;
    Touche* faM = new Touche(this, QString("E"),QString("Fa"));
    faM->move(sizeT*nT,hauteur);
    nT+=1;
    Touche* solM = new Touche(this, QString("R"),QString("Sol"));
    solM->move(sizeT*nT,hauteur);
    nT+=1;
    Touche* laM = new Touche(this, QString("T"),QString("La"));
    laM->move(sizeT*nT,hauteur);
    nT+=1;
    Touche* siM = new Touche(this, QString("Y"),QString("si"));
    siM->move(sizeT*nT,hauteur);
    nT+=1;

    Touche* dom = new Touche(this, QString("U"),QString("Do"));
    dom->move(sizeT*nT,hauteur);
    nT+=1;
    Touche* rem = new Touche(this, QString("I"),QString("Ré"));
    rem->move(sizeT*nT,hauteur);
    nT+=1;
    Touche* mim = new Touche(this, QString("O"),QString("Mi"));
    mim->move(sizeT*nT,hauteur);
    nT+=1;
    Touche* fam = new Touche(this, QString("P"),QString("Fa"));
    fam->move(sizeT*nT,hauteur);
    nT+=1;
    Touche* solm = new Touche(this, QString(/*"dead_circumflex"*/"16781906"),QString("Sol"));
    solm->move(sizeT*nT,hauteur);
    nT+=1;
    Touche* lam = new Touche(this, QString("$"),QString("La"));
    lam->move(sizeT*nT,hauteur);
    nT+=1;
    Touche* sim = new Touche(this, QString("Return"),QString("si"));
    sim->move(sizeT*nT,hauteur);


    nT=4;


    Touche* doMD = new Touche(this, QString("&"),QString("Do#"));
    doMD->black();
//.........这里部分代码省略.........
开发者ID:orichalque,项目名称:quelleEstCetteNote,代码行数:101,代码来源:piano.cpp


注:本文中的QPushButton::resize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。