本文整理汇总了C++中QSlider::installEventFilter方法的典型用法代码示例。如果您正苦于以下问题:C++ QSlider::installEventFilter方法的具体用法?C++ QSlider::installEventFilter怎么用?C++ QSlider::installEventFilter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSlider
的用法示例。
在下文中一共展示了QSlider::installEventFilter方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: connect
void
UnicornVolumeSlider::installFilters()
{
QToolButton* muteButton = findChild<QToolButton*>();
if( muteButton )
muteButton->installEventFilter( this );
QSlider* volumeSlider = findChild<QSlider*>();
if( volumeSlider )
{
volumeSlider->setOrientation( Qt::Vertical );
volumeSlider->installEventFilter( this );
connect( volumeSlider, SIGNAL(valueChanged(int)), SLOT(onVolumeValueChanged(int)));
}
setFixedWidth( 30 );
layout()->setContentsMargins( 0, 10, 0, 10);
setAutoFillBackground( false );
}
示例2: createWidgets
void KMix::createWidgets()
{
QPixmap miniDevPM;
QPixmap WMminiIcon = globalKIL->loadIcon("mixer_mini.xpm");
// keep this enum local. It is really only needed here
enum {audioIcon, bassIcon, cdIcon, extIcon, microphoneIcon,
midiIcon, recmonIcon,trebleIcon, unknownIcon, volumeIcon };
#ifdef ALSA /* not sure if this is for ALSA in general or just my SB16 */
char DefaultMixerIcons[]={
volumeIcon, bassIcon, trebleIcon, midiIcon, audioIcon,
extIcon, microphoneIcon, cdIcon, recmonIcon, recmonIcon, unknownIcon
};
const unsigned char numDefaultMixerIcons=11;
#else
char DefaultMixerIcons[]={
volumeIcon, bassIcon, trebleIcon, midiIcon, audioIcon,
unknownIcon, extIcon, microphoneIcon, cdIcon, recmonIcon,
audioIcon, recmonIcon, recmonIcon, recmonIcon, extIcon,
extIcon, extIcon
};
const unsigned char numDefaultMixerIcons=17;
#endif
// Init DnD: Set up drop zone and drop handler
// dropZone = new KDNDDropZone( this, DndURL );
//connect( dropZone, SIGNAL( dropAction( KDNDDropZone* )),
// SLOT( onDrop( KDNDDropZone*)));
// Window title
setCaption( globalKapp->getCaption() );
// Create a big container containing every widget of this toplevel
Container = new QWidget(this);
setView(Container);
// Create Menu
createMenu();
setMenu(mainmenu);
// Create Sliders (Volume indicators)
MixDevice *MixPtr = mix->First;
while (MixPtr) {
// If you encounter a relayout signal from a mixer device, obey blindly ;-)
connect((QObject*)MixPtr, SIGNAL(relayout()), this, SLOT(placeWidgets()));
int devnum = MixPtr->device_num;
// Figure out default icon
unsigned char iconnum;
if (devnum < numDefaultMixerIcons)
iconnum=DefaultMixerIcons[devnum];
else
iconnum=unknownIcon;
switch (iconnum) {
// TODO: Should be replaceable by user.
case audioIcon:
miniDevPM = globalKIL->loadIcon("mix_audio.xpm"); break;
case bassIcon:
miniDevPM = globalKIL->loadIcon("mix_bass.xpm"); break;
case cdIcon:
miniDevPM = globalKIL->loadIcon("mix_cd.xpm"); break;
case extIcon:
miniDevPM = globalKIL->loadIcon("mix_ext.xpm"); break;
case microphoneIcon:
miniDevPM = globalKIL->loadIcon("mix_microphone.xpm");break;
case midiIcon:
miniDevPM = globalKIL->loadIcon("mix_midi.xpm"); break;
case recmonIcon:
miniDevPM = globalKIL->loadIcon("mix_recmon.xpm"); break;
case trebleIcon:
miniDevPM = globalKIL->loadIcon("mix_treble.xpm"); break;
case unknownIcon:
miniDevPM = globalKIL->loadIcon("mix_unknown.xpm"); break;
case volumeIcon:
miniDevPM = globalKIL->loadIcon("mix_volume.xpm"); break;
default:
miniDevPM = globalKIL->loadIcon("mix_unknown.xpm"); break;
}
QLabel *qb = new QLabel(Container);
if (! miniDevPM.isNull()) {
qb->setPixmap(miniDevPM);
qb->installEventFilter(this);
}
else
cerr << "Pixmap missing.\n";
MixPtr->picLabel=qb;
qb->resize(miniDevPM.width(),miniDevPM.height());
QSlider *VolSB = new QSlider( 0, 100, 10, MixPtr->Left->volume,\
QSlider::Vertical, Container, "VolL");
MixPtr->Left->slider = VolSB; // Remember the Slider (for the eventFilter)
connect( VolSB, SIGNAL(valueChanged(int)), MixPtr->Left, SLOT(VolChanged(int)));
VolSB->installEventFilter(this);
// Create a second slider, when the current channel is a stereo channel.
bool BothSliders = (MixPtr->is_stereo == true );
if ( BothSliders) {
QSlider *VolSB2 = new QSlider( 0, 100, 10, MixPtr->Right->volume,\
//.........这里部分代码省略.........