コード例 #1
0
PlaylistHeader::PlaylistHeader(Qt::Orientation orientation, QWidget* parent)
    : StretchHeaderView(orientation, parent),
      menu_(new QMenu(this)),
      show_mapper_(new QSignalMapper(this))
{
  hide_action_ = menu_->addAction(tr("&Hide..."), this, SLOT(HideCurrent()));
  stretch_action_ = menu_->addAction(tr("&Stretch columns to fit window"), this, SLOT(ToggleStretchEnabled()));
  menu_->addSeparator();

  QMenu* align_menu = new QMenu(tr("&Align text"), this); align_left_action_ = align_menu->addAction(tr("&Left"), this, SLOT(AlignCurrentLeft()));
  align_center_action_ = align_menu->addAction(tr("&Center"), this, SLOT(AlignCurrentCenter()));
  align_right_action_ = align_menu->addAction(tr("&Right"), this, SLOT(AlignCurrentRight()));

  menu_->addMenu(align_menu);
  menu_->addSeparator();

  stretch_action_->setCheckable(true);
  stretch_action_->setChecked(is_stretch_enabled());

  connect(show_mapper_, SIGNAL(mapped(int)), SLOT(ToggleVisible(int)));
  connect(this, SIGNAL(StretchEnabledChanged(bool)), stretch_action_, SLOT(setChecked(bool)));
}
コード例 #2
0
ファイル: stretchheaderview.cpp プロジェクト: Civil/cantata
void StretchHeaderView::ToggleStretchEnabled() {
  SetStretchEnabled(!is_stretch_enabled());
}