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


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

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


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

示例1: ask

void MigrateDialog::ask()
{
    QPushButton *btn = cancelButton();
    QPoint p = btn->mapToGlobal(QPoint(0, 0));
    QRect rc(p.x(), p.y(), btn->width(), btn->height());
    BalloonMsg::ask(NULL, i18n("Cancel convert?"), this, SLOT(cancel(void*)), NULL, &rc);
}
开发者ID:BackupTheBerlios,项目名称:sim-im-svn,代码行数:7,代码来源:migratedlg.cpp

示例2: set_colors

void ColorWidget::set_colors(const QList<QString>& colors)
{
    qDeleteAll(_buttons);
    _buttons.clear();

    _colors = colors;
    for (int i = 0; i < _colors.size(); ++i)
    {
        QPushButton* b = new QPushButton(this);
        b->setFixedWidth(b->height());
        b->setStyleSheet(QString("background-color: #%1; color: #ffffff;").arg(_colors[i]));
        _buttons << b;
        _layout->addWidget(b);
        _mapper->setMapping(b, i);
        connect(b, SIGNAL(clicked()), _mapper, SLOT(map()));
    }

    if (_colors.isEmpty())
    {
        button_pressed(-1);
    }
    else
    {
        button_pressed(0);
    }
}
开发者ID:flopp,项目名称:DesktopJodel,代码行数:26,代码来源:colorWidget.cpp

示例3: setCurrentIndex

void VerticalTabWidget::setCurrentIndex(int index)
{
  int yPos = 25;

  for(unsigned i = 0; i < m_tabButtons.size(); i++)
  {
    QPushButton * button = m_tabButtons[i];

    button->move(0,yPos);

    yPos = yPos + button->height();

    QString imagePath;

    QString style;

    if (i == static_cast<unsigned>(index))
    {
      imagePath = m_selectedPixmaps[i];

      // Ignore clicks to the already active tab
      if(currentIndex != index){
        currentIndex = index;

        style.append("QPushButton { background-color: blue; background-image: url(\"");
        style.append(imagePath);
        style.append("\"); border: none; background-repeat: 0; }");

        button->setStyleSheet(style);

        currentIndex = index;

        emit tabSelected(m_ids[index]);
      }
    }
    else
    {
      if (button->isEnabled()){
        imagePath = m_unSelectedPixmaps[i];
        style.append("QPushButton { background-image: url(\"");
        style.append(imagePath);
        style.append("\"); border: none; background-color: red; background-repeat: 0; }");
      }
      else {
        imagePath = m_disabledPixmaps[i];
        style.append("QPushButton { background-image: url(\"");
        style.append(imagePath);
        style.append("\"); border: none; background-color: red; background-repeat: 0; }");
      }

      button->setStyleSheet(style);
    }
  }
}
开发者ID:NREL,项目名称:OpenStudio,代码行数:54,代码来源:VerticalTabWidget.cpp

示例4: resizeEvent

void MyWidget::resizeEvent( QResizeEvent * )
{
    int startx      = 10;
    int starty      = quit->y() + quit->height() + 10;
    int valueWidth  = (width() - startx - 10 - 3*5)/4;
    int valueHeight = (height() - starty - 10 - 3*5)/4;
    for( int i = 0 ; i < 16 ; i++ )
	value[i]->setGeometry( startx + (i%4)*(5+valueWidth),
			       starty + (i/4)*(5+valueHeight),
                               valueWidth, valueHeight );
}
开发者ID:kthxbyte,项目名称:Qt1.45-Linaro,代码行数:11,代码来源:main.cpp

示例5: paintEvent

void KNoteBook::paintEvent(QPaintEvent *)
{
  //debug("KNoteBook::paintEvent");
  // Check to see if there are any buttons.
  QPushButton *tmp = 0L;
  int w = width(), h = height(), s = 2;
  int tw = pnote->tabbar->width();
  int boffs = 4, toffs = pnote->tabbar->height() + 1;
  if( pnote->ok && pnote->ok->isVisible() )
    tmp = pnote->ok;
  else if(pnote->cancel && pnote->cancel->isVisible())
    tmp = pnote->cancel;
  else if(pnote->def && pnote->def->isVisible())
    tmp = pnote->def;
  else if(pnote->help && pnote->help->isVisible())
    tmp = pnote->help;
  if(tmp)
    boffs = tmp->height() + 4;

  // start painting widget
  QPainter paint;
  paint.begin( this );
  QPen pen( white, 1 );
  paint.setPen( pen );

  // left outer
  paint.drawLine( s, h-(boffs), s, toffs-1);

  // top outer
  paint.drawLine( tw+s , toffs, w-s, toffs);
  
  // right inner
  paint.drawLine( w-(s*3) , toffs+(s*2)+1, w-(s*3), h-(boffs+(s+1)));

  // bottom inner
  paint.drawLine( (s*3)+1 , h-(boffs+(s*2)-1), w-(s*3), h-(boffs+(s*2)-1));

  pen.setColor( black );
  paint.setPen( pen );

  // right outer
  paint.drawLine( w-s , toffs+1, w-s, h-(boffs));

  // bottom outer
  paint.drawLine( w-s , h-(boffs), s+1, h-(boffs));

  // left inner
  paint.drawLine( s*3 , h-(boffs+(s+1)), s*3, toffs+((s*2)+1) );

  // top inner
  paint.drawLine( (s*3)+1, toffs+(s*2), w-(s*3), toffs+(s*2));

  paint.end();
}
开发者ID:kthxbyte,项目名称:KDE1-Linaro,代码行数:54,代码来源:knotebook.cpp

示例6: set_editsearch

void qmainstackwidget::set_editsearch()
{
	edit_search = new QLineEdit(this);
	edit_search->setGeometry(0, 110, 283, 25);
	edit_search->setFont(QFont("Timers", 10, QFont::StyleOblique));
	edit_search->setStyleSheet("QLineEdit{border: 2px solid rgb(22, 154, 218);padding: 0 8px;background: rgb(21, 127, 178);selection-background-color: darkgray;color:rgb(240, 255, 255);}");
	QPushButton *search = new QPushButton(this);
	search->setFlat(true);
	QPixmap pix;
	pix.load("search.jpg");
	pix = pix.scaled(18, 18);
	QIcon icon_search(pix);
	search->setIcon(icon_search);
	search->setFixedSize(18, 18);
	search->move(edit_search->width() - search->width() - 2, (edit_search->height() - search->height()) / 2);
	search->setGeometry(263, 115, search->width(), search->height());
	search->setStyleSheet("QPushButton{ border-image:url(search.png); }"
		"QPushButton:press{border-image:url(search_press.png);}"
		"QPushButton:hover{border-image:url(search_hover.png);}");
	search->setCursor(QCursor(Qt::PointingHandCursor));
}
开发者ID:MRDUAN1,项目名称:exosip_phone,代码行数:21,代码来源:qmainstackwidget.cpp

示例7: Applet

ApplicationsMenuApplet::ApplicationsMenuApplet(void)
  : Applet()
{
  if(QIcon::themeName() == "hicolor" ||
     QIcon::themeName().isEmpty())
  {
    QIcon::setThemeName("nuvola"); // kde
    if(QIcon::fromTheme("start-here").isNull())
      QIcon::setThemeName("gnome"); // gnome
    if(QIcon::fromTheme("start-here").isNull())
      QIcon::setThemeName("hicolor"); // default
  }

  qDebug() << "using theme:" << QIcon::themeName();

//  QIcon::setThemeSearchPaths(CXDGDirs::iconDirectories());
  QPushButton* button = new QPushButton();
  button->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding);
  button->setMenu(m_menu = new QMenu());
  button->setText("Applications");
  button->setIcon(QIcon::fromTheme("start-here").pixmap(button->height(), button->height()));
  setWidget(button);
}
开发者ID:GravisZro,项目名称:qtpanel,代码行数:23,代码来源:applicationsmenuapplet.cpp

示例8: resizeEvent

void KNoteBook::resizeEvent(QResizeEvent *)
{
  //debug("KNote, resizing");

  pnote->tabbar->setGeometry( 2, 2, width()-3, pnote->tabbar->sizeHint().height());

  // Check to see if there are any buttons.
  QPushButton *tmp = 0L;
  int x = 8, y = pnote->tabbar->height() + 7;
  int cx = width() - 14, cy = height()-(pnote->tabbar->height()+14);
  if( pnote->ok && pnote->ok->isVisible() )
    tmp = pnote->ok;
  else if(pnote->cancel && pnote->cancel->isVisible())
    tmp = pnote->cancel;
  else if(pnote->def && pnote->def->isVisible())
    tmp = pnote->def;
  else if(pnote->help && pnote->help->isVisible())
    tmp = pnote->help;
  if(tmp)
    cy -= (tmp->height());

  if(pnote->currentwiz)
    pnote->currentwiz->setGeometry( x, y, cx, cy );

  int offs = 2;
  if(pnote->ok && pnote->ok->isVisible())
  {
    pnote->ok->setGeometry(offs, height()-(pnote->ok->height()+2),
                           pnote->ok->width(), pnote->ok->height());
    offs += 5 + pnote->ok->width();
  }
  if(pnote->cancel && pnote->cancel->isVisible())
  {
    pnote->cancel->setGeometry(offs, height()-(pnote->cancel->height()+2),
                           pnote->cancel->width(), pnote->cancel->height());
    offs += 5 + pnote->cancel->width();
  }
  if(pnote->def && pnote->def->isVisible())
    pnote->def->setGeometry(offs, height()-(pnote->def->height()+2),
                           pnote->def->width(), pnote->def->height());
  if(pnote->help && pnote->help->isVisible())
    pnote->help->setGeometry(width()-(pnote->help->width()+1),
                             height()-(pnote->help->height()+2),
                             pnote->help->width(), pnote->help->height());

  //debug("KNote, resize - done");
}
开发者ID:kthxbyte,项目名称:KDE1-Linaro,代码行数:47,代码来源:knotebook.cpp

示例9: QMainWindow

VPiano::VPiano() : QMainWindow()
{
	QWidget *central = new QWidget(this);
	QVBoxLayout *vb = new QVBoxLayout;
	QHBoxLayout *octaves = new QHBoxLayout;

	QSignalMapper *octaveSignalMapper = new QSignalMapper(this);

	for(int i = 0; i < 9; i++)
	{
		QString title;
		title.setNum(i);
		QPushButton *o = new QPushButton(title, central);
		o->setFixedSize(fontMetrics().width(title)*4, o->height());
		QString shortcut;
		shortcut.setNum(i+1);
		o->setShortcut(QKeySequence(QString("F") + shortcut));
		octaves->addWidget(o);

		connect(o, SIGNAL(clicked()), octaveSignalMapper, SLOT(map()));
		octaveSignalMapper->setMapping(o, i);
	}

	OctaveRangeWidget *octRange = new OctaveRangeWidget(central);
	octaves->addWidget(octRange);

	QSlider *velocity = new QSlider(Qt::Horizontal, central);
	velocity->setMinimum(1);
	velocity->setMaximum(127);
	velocity->setValue(96); // TODO: read prev value from config
	velocity->setToolTip(tr("Velocity"));
	octaves->addWidget(velocity);

	QSpinBox *channel = new QSpinBox(central);
	channel->setPrefix(tr("Ch ", "Midi Channel number"));
	channel->setMinimum(0);
	channel->setMaximum(127);
	channel->setValue(0); // TODO: read prev value from config
	channel->setToolTip(tr("Select MIDI channel number to send messages to"));
	octaves->addWidget(channel);

	vb->addLayout(octaves);

	QHBoxLayout *keyarea = new QHBoxLayout;

	KeyboardWidget *kw = new KeyboardWidget(central);
	keyarea->addWidget(kw);

	QVBoxLayout *rightside = new QVBoxLayout;

	QSlider *pitchWheel = new QSlider(Qt::Vertical, central);
	pitchWheel->setMinimum(-64);
	pitchWheel->setMaximum(63);
	pitchWheel->setValue(0); // TODO: read prev value from config
	pitchWheel->setToolTip(tr("Pitch wheel"));

	rightside->addWidget(pitchWheel);

	QCheckBox *porta = new QCheckBox(central);
	porta->setToolTip(tr("Enable portamento"));

	rightside->addWidget(porta);
	keyarea->addLayout(rightside);

	vb->addLayout(keyarea);

	central->setLayout(vb);
	setCentralWidget(central);
	setWindowTitle(tr("Virtual MIDI keyboard"));

	// TODO: connect pitchWheel
	connect(octaveSignalMapper, SIGNAL(mapped(int)), kw, SLOT(octaveSelected(int)));
	connect(channel, SIGNAL(valueChanged(int)), kw, SLOT(midiChannelSelected(int)));
	connect(kw, SIGNAL(highlightOctaves(int,int)), octRange, SLOT(highlightOctaves(int,int)));

	kw->octaveSelected(0); // TODO: use value read from config
}
开发者ID:berkus,项目名称:vpiano,代码行数:77,代码来源:mainwindow.cpp


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