void QAbstractButtonPrivate::click() { Q_Q(QAbstractButton); down = false; blockRefresh = true; bool changeState = true; if (checked && queryCheckedButton() == q) { // the checked button of an exclusive or autoexclusive group cannot be unchecked #ifndef QT_NO_BUTTONGROUP if (group ? group->d_func()->exclusive : autoExclusive) #else if (autoExclusive) #endif changeState = false; } QPointer<QAbstractButton> guard(q); if (changeState) { q->nextCheckState(); if (!guard) return; } blockRefresh = false; refresh(); q->repaint(); //flush paint event before invoking potentially expensive operation QApplication::flush(); if (guard) emitReleased(); if (guard) emitClicked(); }
NutshBoutonRevenir::NutshBoutonRevenir(QWidget* parent) : QPushButton(parent) { interfaceName = MetaDataInterface; connect(this, SIGNAL(clicked()), this, SLOT(emitClicked())); this->setToolTip(tr("Changer d'affichage")); this->setProperty("boutonRevenir", true); }
DDevIcon::DDevIcon(QWidget *parent) : QWidget(parent) { QStackedLayout *m_Layout = new QStackedLayout; m_Layout->setStackingMode(QStackedLayout::StackAll); int m_breatheListNumber = 23; QStringList breatheSourceList; for (int i = 1; i < m_breatheListNumber; ++i) { breatheSourceList.append(QString(":/ui/images/usb/%1.png").arg(i)); } m_BreatheMovie = new DSerialFrameMovie(breatheSourceList, this); m_BreatheMovie->setDTips("<p style='font-weight:normal;'>"+ tr("Select USB drive") + "</p>"); m_BreatheMovie->showDTips(true); m_Layout->addWidget(m_BreatheMovie); m_Layout->setAlignment(m_BreatheMovie, Qt::AlignHCenter); m_ProgressWidget = new QWidget; QHBoxLayout *progressLayout = new QHBoxLayout; progressLayout->addSpacing(6); m_ProgressMovie = new DUsbProgressMovie; progressLayout->addWidget(m_ProgressMovie); m_ProgressWidget->setLayout(progressLayout); m_Layout->addWidget(m_ProgressWidget); m_LightWidget = new QWidget; QHBoxLayout *lightLayout = new QHBoxLayout; lightLayout->addSpacing(15); lightLayout->setContentsMargins(0,0,0,1); lightLayout->setSpacing(0); QLabel *m_Light = new QLabel; m_Light->setPixmap(QPixmap(":/ui/images/usb/light.png")); lightLayout->addWidget(m_Light); lightLayout->setAlignment(m_Light, Qt::AlignVCenter); m_LightWidget->setLayout(lightLayout); m_Layout->addWidget(m_LightWidget); m_LightWidget->setAttribute(Qt::WA_TransparentForMouseEvents,true); this->setLayout(m_Layout); setStatus(UnSelected); connect(m_BreatheMovie, SIGNAL(clicked()), this, SLOT(emitClicked())); }
GameJoinButton::GameJoinButton(uint gameid, Widget* parent) : Button(QString("%1").arg(gameid), parent) { this->gameid = gameid; connect(this, SIGNAL(clicked()), this, SLOT(emitClicked())); }
Playlist::Playlist(QWidget* parent) : QTreeWidget( parent ) , m_marker( 0 ) , m_CurrentTrackColor(QColor( 255,100,100 )) , m_NextTrackColor(QColor( 200,200,255 )) , m_PlaylistMode( Playlist::Playlist_Single ) , nextPlaylistItem (0) , previousPlaylistItem(0) , currentPlaylistItem(0) , newPlaylistItem(0) , m_alternateMax(0) , showDropHighlighter(false) , autoClearOn(false) , m_isPlaying(false) , m_isInternDrop(false) , m_dragLocked(false) , isChangeSignalEnabled(true) { setSortingEnabled( false ); setAcceptDrops( true ); setDragEnabled( true ); setAllColumnsShowFocus( false ); setDropIndicatorShown(true); setAcceptDrops(true); setDragEnabled(true); setSelectionBehavior(QAbstractItemView::SelectRows); setSelectionMode(QAbstractItemView::ExtendedSelection); setDragDropMode(QAbstractItemView::InternalMove); setAttribute(Qt::WA_MacShowFocusRect, false); setUniformRowHeights(true); QStringList headers; headers << tr("Url")<<tr("No")<<tr("Played")<<tr("Artist")<<tr("Title"); headers <<tr("Album")<<tr("Year")<<tr("Genre")<<tr("Track"); headers <<tr("Length")<<tr("Rate"); QTreeWidgetItem *headeritem = new QTreeWidgetItem(headers); setHeaderItem(headeritem); setHeaderLabels(headers); header()->setResizeMode(QHeaderView::Interactive); header()->hideSection(PlaylistItem::Column_Url); // prevent click event if doubleclicked ignoreNextRelease = false; timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(emitClicked())); timerDragLock = new QTimer(this); timerDragLock->setInterval(300); connect(timerDragLock, SIGNAL(timeout()), this, SLOT(timeoutDragLock())); connect( this, SIGNAL(itemClicked(QTreeWidgetItem*,int)) , this, SLOT(slotItemClicked(QTreeWidgetItem*,int))); connect( this, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)) , this, SLOT(slotItemDoubleClicked(QTreeWidgetItem*,int))); connect( this, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(slotItemChanged(QTreeWidgetItem*,QTreeWidgetItem*))); }
/* Button click event. */ void QEGenericButton::userClicked( bool checked ) { // Do nothing if nothing to do. (no point asking for confirmation or password) // Then keep doing nothing if user confirmation required but not given, or password required but not given if(( !writeOnClick && programLauncher.getProgram().isEmpty() && guiName.isEmpty() ) || !confirmAction() || !checkPassword() ) return; // Get the variable to write to QEString *qca = (QEString*)getQcaItem(0); // If the object is set up to write when the user clicks the button // emit a signal // Also, if a QCa object is present (if there is a variable to write to) // then write the value if( writeOnClick ) { // Determine the string to write QString writeText; if( !checked ) { writeText = clickText; } else { writeText = clickCheckedText; } writeText = substituteThis( writeText ); // Emit a 'clicked' signal emitClicked( writeText.toInt() ); // Write to the variable if present if( qca ) { QString error; if( !qca->writeString( writeText, error ) ) { QMessageBox::warning( (QWidget*)getButtonQObject(), QString( "Write failed" ), error, QMessageBox::Cancel ); } } } // If there is a command to run, run it, with substitutions applied to the command and arguments programLauncher.launch( (VariableNameManager*)this, getButtonQObject() ); // If a new GUI is required, start it if( !guiName.isEmpty() ) { // Publish the profile this button recieved publishOwnProfile(); // Extend any variable name substitutions with this button's substitutions // Like most other macro substitutions, the substitutions already present take precedence. addMacroSubstitutions( getVariableNameSubstitutions() ); // Extend any variable name substitutions with this button's priority substitutions // Unlike most other macro substitutions, these macro substitutions take precedence over // substitutions already present. addPriorityMacroSubstitutions( prioritySubstitutions ); // Start the GUI emitNewGui( QEActionRequests( substituteThis( guiName ), customisationName, creationOption ) ); // Remove this button's priority macro substitutions now all its children are created removePriorityMacroSubstitutions(); // Remove this button's normal macro substitutions now all its children are created removeMacroSubstitutions(); // Release the profile now all QE widgets have been created releaseProfile(); } }