예제 #1
0
void QmvItem::createResetButton()
{
    if ( resetButton ) {
	resetButton->parentWidget()->lower();
	return;
    }
    QHBox *hbox = new QHBox( listview->viewport() );
    hbox->setFrameStyle( QFrame::StyledPanel | QFrame::Sunken );
    hbox->setLineWidth( 1 );
    resetButton = new QPushButton( hbox );
    resetButton->setPixmap( QPixmap(resetproperty_xpm));
    resetButton->setFixedWidth( resetButton->sizeHint().width() );
    hbox->layout()->setAlignment( Qt::AlignRight );
    listview->addChild( hbox );
    hbox->hide();
    QObject::connect( resetButton, SIGNAL( clicked() ),
		      listview, SLOT( resetAttribute() ) );
    QToolTip::add( resetButton, QmvEditor::tr( "Reset attribute to its default value" ) );
    QWhatsThis::add( resetButton,
                     QmvEditor::tr( "Click this button to reset the Attribute"
                                           "to its default value" ) );
    updateResetButtonState();
}
예제 #2
0
PlayerBox::PlayerBox(bool playerOne, QWidget* parent, const char* name)
  : QGroupBox(parent, name)
{
  QHBoxLayout* l = new QHBoxLayout(this, PLAYERBOX_BORDERS, 
				   PLAYERBOX_HDISTANCEOFWIDGETS);

  // The card and "held" label arrays.
  m_cardWidgets = new CardWidget *[PokerHandSize];
  m_heldLabels  = new QLabel *[PokerHandSize];

  QFont myFixedFont;
  myFixedFont.setPointSize(12);

  // Generate the 5 cards
  for (int i = 0; i < PokerHandSize; i++) {
    QVBoxLayout* vl = new QVBoxLayout(0);
    l->addLayout(vl, 0);

    QHBox* cardBox = new QHBox(this);
    vl->addWidget(cardBox, 0);
    cardBox->setFrameStyle(Box | Sunken);
    m_cardWidgets[i] = new CardWidget(cardBox);
    cardBox->setFixedSize(cardBox->sizeHint());

    // Only add the "held" labels if this is the first player (the human one).
    if (playerOne) {
      QHBox* b = new QHBox(this);
      m_heldLabels[i] = new QLabel(b);
      m_heldLabels[i]->setText(i18n("Held"));
      b->setFrameStyle(Box | Sunken);
      b->setFixedSize(b->sizeHint());
      m_cardWidgets[i]->heldLabel = m_heldLabels[i];

      QHBoxLayout* heldLayout = new QHBoxLayout(0);
      heldLayout->addWidget(b, 0, AlignCenter);
      vl->insertLayout(0, heldLayout, 0);
      vl->insertStretch(0, 1);
      vl->addStretch(1);
    }
  }

  // Add the cash and bet labels.
  {
    QVBoxLayout* vl = new QVBoxLayout;
    l->addLayout(vl);
    vl->addStretch();

    m_cashLabel = new QLabel(this);
    m_cashLabel->setFrameStyle(QFrame::WinPanel | QFrame::Sunken);
    m_cashLabel->setFont(myFixedFont);
    vl->addWidget(m_cashLabel, 0, AlignHCenter);
    vl->addStretch();

    m_betLabel = new QLabel(this);
    m_betLabel->setFrameStyle(QFrame::WinPanel | QFrame::Sunken);
    m_betLabel->setFont(myFixedFont);
    vl->addWidget(m_betLabel, 0, AlignHCenter);
    vl->addStretch();
  }

  QToolTip::add(m_cashLabel,
		i18n("Money of %1").arg("Player"));//change via showName()

  // Assume that we have a multiplayer game.
  m_singlePlayer = false;
}