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


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

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


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

示例1: setTvShow

void UIShowPanel::setTvShow( TVShow *tvshow )
{
    if( tvshow != NULL )
    {
        this->destroyShowUI();

        this->tvshow = tvshow;
        this->show_status->setText( this->engineLanguage->get( "translation.status" ) + " " + tvshow->getStatus() );
        this->show_status->adjustSize();
        this->show_started->setText( this->engineLanguage->get( "translation.started" ) + " " + tvshow->getStarted() );
        this->show_started->adjustSize();
        this->show_ended->setText( this->engineLanguage->get( "translation.ended" ) + " " + tvshow->getEnded() );
        this->show_ended->adjustSize();
        this->show_country->setText( this->engineLanguage->get( "translation.country" ) + " " + tvshow->getCountry() );
        this->show_country->adjustSize();
        this->optionsPanel->setTVShow( tvshow );
        this->title->setText( this->tvshow->getName() );
        this->title->adjustSize();
        this->categorie->setText( this->tvshow->getCategory() );
        int i, size = this->stars.size();
        for( i = 0; i < size; i++ )
        {
            if( i < this->tvshow->getStars() )
                stars.at(i)->setPixmap( *this->enginePicture->getPicture( PICTURE_STAR_FULL ) );
        }

        const vector< vector<Episode*> > *showSeasons = tvshow->getSeasons();
        size = showSeasons->size();
        int top = 0, space = 3;
        for( i = size - 1; i >= 0; i-- )
        {
            QLabel *season = new QLabel( this->engineLanguage->get( "translation.season" ) + " " + QString::number( i + 1 ), this->moveConteneur );
            season->setFixedWidth( 430 );
            season->setStyleSheet( "background-color: #1D1D1D; border-radius: 8px; padding-left: 10px; color: #ECECEC;" );
            season->move( 0, top );

            int j, sizeEpisode = showSeasons->at(i).size();
            for( j = sizeEpisode - 1; j >= 0; j-- )
            {
                Episode *episode = showSeasons->at(i).at(j);

                JLabel *labelEpisode = new JLabel( this->moveConteneur );
                labelEpisode->setText( this->engineLanguage->get( "translation.episode" ) + " " + QString::number( j + 1 ) + ": " + episode->getName() + " - " + episode->getDate().toString() );
                labelEpisode->setStyleSheet( "padding-left: 2px;" );
                labelEpisode->setNormalHoverStyle( "padding-left: 2px;", "background-color: #D1D1D1; border-radius: 5px; padding-left: 2px;" );
                labelEpisode->adjustSize();
                labelEpisode->setFixedWidth( 400 );
                labelEpisode->setToolTip( episode->getName() + " - " + episode->getDate().toString() );

                JLabel *check = NULL;
                if( tvshow->isAfterLast(  i + 1, j + 1  ) != 2 ) // Do we need checkbox ?
                {
                    check = new JLabel( this->moveConteneur );
                    if( tvshow->getEpisode(  i + 1, j + 1  )->isSaw() ) // Episode already saw
                        check->setPixmap( *this->enginePicture->getPicture( PICTURE_CHECK ) );
                    else check->setPixmap( *this->enginePicture->getPicture( PICTURE_UNCHECK ) );
                    this->checks.push_back( check );
                }

                if( j != 0 )
                {
                    QLabel *separator = new QLabel( this->moveConteneur );
                    separator->setStyleSheet( "background-color: #C4C4C4;" );
                    separator->setFixedSize( 400, 1 );
                    this->separators.push_back( separator );
                    top += labelEpisode->height() + separator->height() + space * 2;
                    labelEpisode->move( 20, top );
                    separator->move( 20, labelEpisode->pos().y() + labelEpisode->height() + space );
                }
                else
                {
                    top += labelEpisode->height() + space * 2;
                    labelEpisode->move( 20, top );
                    top += 30;
                }

                if( check != NULL )
                    check->move( 0, labelEpisode->pos().y() );
                this->episodes.push_back( labelEpisode );
            }

            this->seasons.push_back( season );
        }

        this->moveConteneur->adjustSize();
        this->listConteneur->adjustSize();
    }
    else cout << "WARNING: Try to set an NULL show - void UIShowPanel::setTvShow( TVShow *tvshow )" << endl;
}
开发者ID:bdajeje,项目名称:MyFavorites,代码行数:89,代码来源:uishowpanel.cpp

示例2: QWidget

TrayNotificationWidget::TrayNotificationWidget(QPixmap pixmapIcon, QString headerText, QString messageText) : QWidget(0)
{
    setWindowFlags(
        #ifdef Q_OS_MAC
            Qt::SubWindow | // This type flag is the second point
        #else
            Qt::Tool |
        #endif
            Qt::FramelessWindowHint |
            Qt::WindowSystemMenuHint |
            Qt::WindowStaysOnTopHint
        );
    setAttribute(Qt::WA_NoSystemBackground, true);
    // set the parent widget's background to translucent
    setAttribute(Qt::WA_TranslucentBackground, true);

    //setAttribute(Qt::WA_ShowWithoutActivating, true);

    setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    // create a display widget for displaying child widgets
    QWidget* displayWidget = new QWidget;
    displayWidget->setStyleSheet(".QWidget { background-color: rgba(0, 0, 0, 75%); border-width: 1px; border-style: solid; border-radius: 10px; border-color: #555555; } .QWidget:hover { background-color: rgba(68, 68, 68, 75%); border-width: 2px; border-style: solid; border-radius: 10px; border-color: #ffffff; }");

    QLabel* icon = new QLabel;
    icon->setPixmap(pixmapIcon);
    icon->setMaximumSize(32, 32);
    QLabel* header = new QLabel;
    header->setMaximumSize(250, 50);
    header->setWordWrap(true);
    header->setText(headerText);
    header->setStyleSheet("QLabel { color: #ffffff; font-weight: bold; font-size: 12px; }");
    QTextEdit *message = new QTextEdit;
    message->setReadOnly(true);
    message->setFrameStyle(QFrame::NoFrame);
    message->setLineWrapMode(QTextEdit::WidgetWidth);
    message->setWordWrapMode(QTextOption::WrapAnywhere);
    QPalette pal = palette();
    pal.setColor(QPalette::Base, Qt::transparent);
    message->setPalette(pal);
    message->setStyleSheet("QTextEdit { color: #ffffff; font-size: 10px; }");
    message->setText(messageText);
    message->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

    QVBoxLayout* vl = new QVBoxLayout;
    vl->addWidget(header);
    vl->addWidget(message);

    QHBoxLayout* displayMainLayout = new QHBoxLayout;
    displayMainLayout->addWidget(icon);
    displayMainLayout->addLayout(vl);
    displayWidget->setLayout(displayMainLayout);

    QHBoxLayout* containerLayout = new QHBoxLayout;
    containerLayout->addWidget(displayWidget);
    setLayout(containerLayout);

    show();
    setMinimumHeight((int)(message->document()->size().height() *1.5 + header->height() +70));

    timeout = new QTimer(this);
    connect(timeout, SIGNAL(timeout()), this, SLOT(fadeOut()));
    timeout->start(3000);
}
开发者ID:Lhassa,项目名称:seafile-client,代码行数:63,代码来源:traynotificationwidget.cpp

示例3: eventFilter

    ///////////////////////////////////////////////////////////
    // Function type:  Virtual
    // Contributors:   Pokedude
    // Last edit by:   Pokedude
    // Date of edit:   8/25/2016
    //
    ///////////////////////////////////////////////////////////
    bool MovePermissionListener::eventFilter(QObject *o, QEvent *event)
    {
        QLabel *obj = dynamic_cast<QLabel *>(o);

        if (event->type() == QEvent::MouseButtonPress)
        {
            QMouseEvent *me = reinterpret_cast<QMouseEvent *>(event);

            int mouseX = me->pos().x();
            int mouseY = me->pos().y();
            if (mouseX < 0 || mouseY < 0 ||
                mouseX >= obj->width() || mouseY >= obj->height() ||
                me->buttons() != Qt::MouseButton::LeftButton)
            {
                return QObject::eventFilter(o, event);
            }

            m_ShowCursor = false;
            m_Selecting = true;

            // Align the position to a block
            mouseX /= 16;
            mouseY /= 16;

            // Sets the position
            m_SelectedIndex = mouseX + (mouseY * 4);
            obj->repaint();

            // Simulates mouse button press on label
            return QObject::eventFilter(o, event);
        }
        if (event->type() == QEvent::MouseButtonRelease)
        {
            m_ShowCursor = true;
            m_Selecting = false;
        }
        else if (event->type() == QEvent::MouseMove)
        {
            QMouseEvent *me = reinterpret_cast<QMouseEvent *>(event);

            int mouseX = me->pos().x();
            int mouseY = me->pos().y();

            if (mouseX < 0)
                mouseX = 0;
            if (mouseY < 0)
                mouseY = 0;
            if (mouseX >= obj->width())
                mouseX = obj->width() - 1;
            if (mouseY >= obj->height())
                mouseY = obj->height() - 1;

            if (!m_Selecting)
                m_ShowCursor = true;

            // Align the position to a block
            mouseX /= 16;
            mouseY /= 16;

            // Sets the position
            if (m_HighlightedBlock != mouseX + (mouseY * 4))
            {
                m_HighlightedBlock = mouseX + (mouseY * 4);
                if (m_Selecting)
                    m_SelectedIndex = m_HighlightedBlock;
                obj->repaint();
            }

            // Simulates mouse button press on label
            return QObject::eventFilter(o, event);
        }
        else if (event->type() == QEvent::Leave)
        {
            m_ShowCursor = false;
        }
        else if (event->type() == QEvent::Paint/* && m_SelectedIndex.first != -1 && m_SelectedIndex.second != -1*/)
        {
            bool result = QObject::eventFilter(o, event);

            QPixmap pm(":/images/Permissions_16x16.png");
            QPainter painter(&pm);
            painter.setPen(Qt::GlobalColor::red);
            painter.drawRect((m_SelectedIndex % 4) * 16, (m_SelectedIndex / 4) * 16, 15, 15);
            if (m_ShowCursor)
            {
                painter.setPen(Qt::GlobalColor::green);
                painter.drawRect((m_HighlightedBlock % 4) * 16, (m_HighlightedBlock / 4) * 16, 15, 15);
            }
            painter.end();
            obj->setPixmap(pm);

            return result;
        }
//.........这里部分代码省略.........
开发者ID:Diegoisawesome,项目名称:AwesomeMapEditor,代码行数:101,代码来源:MovePermissionListener.cpp

示例4: updateItemWidgets

void AccountsListDelegate::updateItemWidgets(const QList<QWidget *> widgets, const QStyleOptionViewItem &option, const QPersistentModelIndex &index) const
{
    // draws:
    //                   AccountName
    // Checkbox | Icon |              | ConnectionIcon | ConnectionState
    //                   errorMessage

    if (!index.isValid()) {
        return;
    }

    Q_ASSERT(widgets.size() == 6);

    // Get the widgets
    QCheckBox* checkbox = qobject_cast<QCheckBox*>(widgets.at(0));
    ChangeIconButton* changeIconButton = qobject_cast<ChangeIconButton*>(widgets.at(1));
    QLabel *statusTextLabel = qobject_cast<QLabel*>(widgets.at(2));
    QLabel *statusIconLabel = qobject_cast<QLabel*>(widgets.at(3));
    EditDisplayNameButton *displayNameButton = qobject_cast<EditDisplayNameButton*>(widgets.at(4));
    QLabel *connectionErrorLabel = qobject_cast<QLabel*>(widgets.at(5));

    Q_ASSERT(checkbox);
    Q_ASSERT(changeIconButton);
    Q_ASSERT(statusTextLabel);
    Q_ASSERT(statusIconLabel);
    Q_ASSERT(displayNameButton);
    Q_ASSERT(connectionErrorLabel);


    bool isSelected(itemView()->selectionModel()->isSelected(index) && itemView()->hasFocus());
    bool isEnabled(index.data(KTp::AccountsListModel::EnabledRole).toBool());
    KIcon accountIcon(index.data(Qt::DecorationRole).value<QIcon>());
    KIcon statusIcon(index.data(KTp::AccountsListModel::ConnectionStateIconRole).value<QIcon>());
    QString statusText(index.data(KTp::AccountsListModel::ConnectionStateDisplayRole).toString());
    QString displayName(index.data(Qt::DisplayRole).toString());
    QString connectionError(index.data(KTp::AccountsListModel::ConnectionErrorMessageDisplayRole).toString());
    Tp::AccountPtr account(index.data(KTp::AccountsListModel::AccountRole).value<Tp::AccountPtr>());

    if (!account->isEnabled()) {
      connectionError = i18n("Click checkbox to enable");
    }

    QRect outerRect(0, 0, option.rect.width(), option.rect.height());
    QRect contentRect = outerRect.adjusted(m_hpadding,m_vpadding,-m_hpadding,-m_vpadding); //add some padding


    // checkbox
    if (isEnabled) {
        checkbox->setChecked(true);;
        checkbox->setToolTip(i18n("Disable account"));
    } else {
        checkbox->setChecked(false);
        checkbox->setToolTip(i18n("Enable account"));
    }

    int checkboxLeftMargin = contentRect.left();
    int checkboxTopMargin = (outerRect.height() - checkbox->height()) / 2;
    checkbox->move(checkboxLeftMargin, checkboxTopMargin);


    // changeIconButton
    changeIconButton->setIcon(accountIcon);
    changeIconButton->setAccount(account);
    // At the moment (KDE 4.8.1) decorationSize is not passed from KWidgetItemDelegate
    // through the QStyleOptionViewItem, therefore we leave default size unless
    // the user has a more recent version.
    if (option.decorationSize.width() > -1) {
        changeIconButton->setButtonIconSize(option.decorationSize.width());
    }

    int changeIconButtonLeftMargin = checkboxLeftMargin + checkbox->width();
    int changeIconButtonTopMargin = (outerRect.height() - changeIconButton->height()) / 2;
    changeIconButton->move(changeIconButtonLeftMargin, changeIconButtonTopMargin);


    // statusTextLabel
    QFont statusTextFont = option.font;
    QPalette statusTextLabelPalette = option.palette;
    if (isEnabled) {
        statusTextLabel->setEnabled(true);
        statusTextFont.setItalic(false);
    } else {
        statusTextLabel->setDisabled(true);
        statusTextFont.setItalic(true);
    }
    if (isSelected) {
        statusTextLabelPalette.setColor(QPalette::Text, statusTextLabelPalette.color(QPalette::Active, QPalette::HighlightedText));
    }
    statusTextLabel->setPalette(statusTextLabelPalette);
    statusTextLabel->setFont(statusTextFont);
    statusTextLabel->setText(statusText);
    statusTextLabel->setFixedSize(statusTextLabel->fontMetrics().boundingRect(statusText).width(),
                                  statusTextLabel->height());
    int statusTextLabelLeftMargin = contentRect.right() - statusTextLabel->width();
    int statusTextLabelTopMargin = (outerRect.height() - statusTextLabel->height()) / 2;
    statusTextLabel->move(statusTextLabelLeftMargin, statusTextLabelTopMargin);


    // statusIconLabel
    statusIconLabel->setPixmap(statusIcon.pixmap(KIconLoader::SizeSmall));
//.........这里部分代码省略.........
开发者ID:KDE,项目名称:ktp-accounts-kcm,代码行数:101,代码来源:accounts-list-delegate.cpp

示例5: refresh

void HudScheduling::refresh()
{
	int highestPriority = findHighestPriority();
	int lowestCycles = findLowestCycles();
	int highestCycles = findHighestCycles();

	// Update progressbar
	const int kPrecition = 500;
	float timeUntilScheduling = SETTINGS->timeUntilScheduling;
	if(timeUntilScheduling < 0.0f)
		timeUntilScheduling = 0.0f;
	float schedulerTime = SETTINGS->schedulerTime;

	float schedulingRatio = timeUntilScheduling /schedulerTime;
	int test = timeUntilScheduling /schedulerTime * kPrecition;
	int schedulingProgressbarRatio = kPrecition - test;
	if(progressbar->value() != schedulingProgressbarRatio)
	{
		progressbar->setValue(schedulingProgressbarRatio);
		progressbar->update();

		// Turn bar red if at scheduling
		if(schedulingProgressbarRatio == kPrecition)
		{
			if(!isScheduling)
			{
				isScheduling = true;
				progressbar->setStyleSheet("QProgressBar::chunk{background-color: rgba(255, 0, 0, 75);}");
			}
		}
		else if(isScheduling)
		{
			isScheduling = false;
			progressbar->setStyleSheet("");
		}
	}


	// Put each item (player) into the correct place relative 
	// to each other based on their priority

	int labelSize = subWindow->height();
	int areaWidth = subWindow->width() - itemWidth;
	float sectionSize = 0; 
	if(highestPriority > 0)
		sectionSize = areaWidth/highestPriority;


	// Determine size and location for each label
	for(int i=0; i<items.size(); i++)
	{
		HudScheduling_Item* item = &items[i];

		int priority = item->ptr_player->priority;
		int cycles = item->ptr_player->cycles;


		// Find our relative index and number of neighbours
		CountAndIndex countAndIndex = findRelativeIndex(priority, i);
		int numNeighbours = countAndIndex.count;
		int relativeIndex = countAndIndex.index;


		// Compute size
		float cycleRatio = 1.0f;
		int deltaCycles = highestCycles - lowestCycles;
		if(deltaCycles > 0)
			cycleRatio = ((float)(cycles - lowestCycles)) / deltaCycles;
		const float kCycleRatioInfluence = 0.4f;
		int newItemHeight = itemHeight * (1.0f - kCycleRatioInfluence) + itemHeight * kCycleRatioInfluence * cycleRatio;
			
		if(item->label->height() != newItemHeight)
			item->label->resize(itemWidth, newItemHeight);
		

		// Compute location
		int index = item->ptr_player->priority;
		if(index < 0)
			index = 0;

		// Make sure all indicators fits by 
		// flipping them if they reach the left
		// edge (reaches max priority)
		if(priority > 0 && priority == highestPriority)
			relativeIndex = -relativeIndex;

		float crowdOffset = relativeIndex * itemWidth;
		int offset = (int)(sectionSize * index + crowdOffset);
		Float2 target;
		target.x = subWindow->x() + offset;
		target.y = subWindow->y() + (itemHeight - newItemHeight);
		item->targetPosition = target;
	}

	// Update labels so they can
	// interpolate to the correct
	// position
	for(int i=0; i<items.size(); i++)
	{
		HudScheduling_Item* item = &items[i];
//.........这里部分代码省略.........
开发者ID:L0mion,项目名称:xkill-source,代码行数:101,代码来源:HudScheduling.cpp

示例6: QColor


//.........这里部分代码省略.........
    lblStepTop->setPaintShadow(false);
    QLabel *picNeutral = new QLabel(step);
    QPixmap pix = QPixmap(Utils::getResourcesDirectory() + "/tuto/neutral_" + locale + ".png");
    picNeutral->setPixmap(pix);
    vLayoutStep->addWidget(lblStepTop);
    vLayoutStep->addWidget(picNeutral);
    stepper->addStep(tr("Information"),true,false,true, StepperNewGesture::First ,step);

    /* STEP 1 */
    Label *step1 = new Label(tr("You will have 5 seconds to place\nbefore registering your gesture\n1/") + QString::number(pNumberOfGesture),stepper);
    step1->changeFontSize(labelFontSize);
    step1->setTextColor(labelColor);
    step1->setPaintShadow(false);
    stepper->addStep(tr("Add a new gesture"),true,true,true, StepperNewGesture::StartTimer ,step1);

    /* STEP 2 */
    Label *step2 = new Label(tr("Ready ?"),stepper);
    step2->changeFontSize(labelFontSize);
    step2->setTextColor(labelColor);
    step2->setPaintShadow(false);
    stepper->addStep(tr("Add a new gesture"),false,true,true,StepperNewGesture::StartRecording ,step2);

    /* STEP 3 */
    QWidget* step3 = new QWidget(parent);
    QVBoxLayout* vLayoutStep3 = new QVBoxLayout(step3);
    GlView* glViewStep3= new GlView(step3);
    DAOLayer* dao = DAOLayer::getInstance();
    connect(dao, SIGNAL(skeletonDataReceived(QString)), glViewStep3,SLOT(skeletonDataReceived(QString)));
    Label* labelStep3 = new Label(tr("Realtime visualizer"), step3);
    labelStep3->setFixedHeight(50);
    labelStep3->changeFontSize(labelFontSize);
    labelStep3->setTextColor(labelColor);
    labelStep3->setPaintShadow(false);
    vLayoutStep3->addWidget(labelStep3);
    vLayoutStep3->addWidget(glViewStep3);
    glViewStep3->startAnimating();
    stepper->addStep(tr("Add a new gesture"),false,true,true,StepperNewGesture::VisualizeRecording ,step3);

    /* STEP 4 */
    QWidget* step4 = new QWidget(parent);
    QVBoxLayout* vLayoutStep4 = new QVBoxLayout(step4);
    this->glViewStep4= new GlView(step4);
    connect(this->executionManager, SIGNAL(gestureRecorded(Gesture*)), this, SLOT(gestureReceived(Gesture*)));
    Label *labelStep4 = new Label(tr("Is it the right gesture ?"),stepper);
    labelStep4->setFixedHeight(50);
    labelStep4->changeFontSize(labelFontSize);
    labelStep4->setTextColor(labelColor);
    labelStep4->setPaintShadow(false);
    vLayoutStep4->addWidget(labelStep4);
    vLayoutStep4->addWidget(this->glViewStep4);
    this->glViewStep4->startAnimating();
    stepper->addStep(tr("Add a new gesture"),true,true,true,StepperNewGesture::ConfigureAction,step4);

    /* STEP 5 */
    QWidget* step5 = new QWidget(parent);
    QVBoxLayout* vLayout = new QVBoxLayout(step5);


    QWidget* step5Bottom = new QWidget(step5);
    QHBoxLayout* hLayoutStep5 = new QHBoxLayout(step5Bottom);
    this->commandChooser->setParent(step5Bottom);

    ComboBox *combo = this->commandChooser->getCommandComboBox();
    KeyListener *keyListener = this->commandChooser->getCommandKeyListener();
    TextField *tfNewGesture = this->commandChooser->getCommandTextField();
    ButtonElement *btnCommand = this->commandChooser->getCommandButton();
    Label* labelRecordName = new Label("Record name : ",step5);
    labelRecordName->setPaintShadow(false);
    labelRecordName->setTextColor(labelColor);
    TextField *tfRecordName = this->commandChooser->getRecordNameTextField();


    hLayoutStep5->addWidget(combo);
    hLayoutStep5->addWidget(keyListener);
    hLayoutStep5->addWidget(tfNewGesture);
    hLayoutStep5->addWidget(btnCommand);
    hLayoutStep5->addWidget(labelRecordName);
    hLayoutStep5->addWidget(tfRecordName);

    Label *labelStep5 = new Label(tr("Command linked to your gesture"),step5);
    labelStep5->setPaintShadow(false);
    labelStep5->changeFontSize(labelFontSize);
    labelStep5->setTextColor(labelColor);
    labelStep5->setFixedHeight(50);

    vLayout->addWidget(labelStep5);
    vLayout->addWidget(step5Bottom);

    stepper->addStep(tr("Add a new gesture"),true,false,true,StepperNewGesture::SaveRecord,step5);

    /* STEP 6 */
    QWidget* step6 = new QWidget(parent);
    QLabel* labelLoading = new QLabel(step6);
    QMovie* loading = new QMovie(Utils::getResourcesDirectory() + "loader.gif", QByteArray(), labelLoading);
    labelLoading->resize(128, 128);
    labelLoading->setMovie(loading);
    loading->start();
    stepper->addStep(tr("Add a new gesture"),false,false,false,StepperNewGesture::Close,step6);
    labelLoading->move(step6->width()/2 - labelLoading->width()/2, step6->height()/2 - labelLoading->height()/2);
}
开发者ID:FreeStroke,项目名称:FreeStroke,代码行数:101,代码来源:stepsnewgesture.cpp

示例7: placeWidgets

void KMix::placeWidgets()
{
  int sliderHeight=100;
  int qsMaxY=0;
  int ix = 0;
  int iy = 0;

  QSlider *qs;
  QLabel  *qb;

  // Place Sliders (Volume indicators)
  ix  = 0;
  if (mainmenuOn)
    mainmenu->show();
  else
    mainmenu->hide();


  bool first = true;
  MixDevice *MixPtr = mix->First;
  while (MixPtr) {
    if (MixPtr->is_disabled) {
      MixPtr->picLabel->hide();
      MixPtr->Left->slider->hide();
      if (MixPtr->is_stereo)
	MixPtr->Right->slider->hide();
      MixPtr=MixPtr->Next;
      continue;
    }

    if ( !first ) ix += 6;
    else          ix += 4; // On first loop add 4

    int old_x=ix;

    qb = MixPtr->picLabel;

    // left slider
    qs = MixPtr->Left->slider;
    if (tickmarksOn) {
      qs->setTickmarks(QSlider::Left);
      qs->setTickInterval(10);
    }
    else
      qs->setTickmarks(QSlider::NoMarks);

    QSize VolSBsize = qs->sizeHint();
    qs->setValue(100-MixPtr->Left->volume);
    qs->setGeometry( ix, iy+qb->height(), VolSBsize.width(), sliderHeight);

    qs->move(ix,iy+qb->height());
    qs->show();

    // Its a good point to find out the maximum y pos of the slider right here
    if (first)
      qsMaxY = qs->y()+qs->height();

    ix += qs->width();

    // But make sure it isn't linked to the left channel.
    bool BothSliders =
      (MixPtr->is_stereo  == true ) &&
      (MixPtr->StereoLink == false);

    QString ToolTipString;
    ToolTipString = MixPtr->name();
    if ( BothSliders)
      ToolTipString += " (Left)";
    QToolTip::add( qs, ToolTipString );

    // Mark record source(s) and muted channel(s). This is done by ordinary
    // color marks on the slider, but this will be changed by red and green
    // and black "bullets" below the slider. TODO !!!
    if (MixPtr->is_recsrc)
      qs->setBackgroundColor( red );
    else {
      if (MixPtr->is_muted)
	qs->setBackgroundColor( black );
      else
	qs->setBackgroundColor( colorGroup().mid() );
    }

    if (MixPtr->is_stereo  == true) {
      qs = MixPtr->Right->slider;
	
      if (MixPtr->StereoLink == false) {
	// Show right slider
	if (tickmarksOn) {
	  qs->setTickmarks(QSlider::Right);
	  qs->setTickInterval(10);
	}
	else
	  qs->setTickmarks(QSlider::NoMarks);
	
	QSize VolSBsize = qs->sizeHint();
	qs->setValue(100-MixPtr->Right->volume);
	qs->setGeometry( ix, iy+qb->height(), VolSBsize.width(), sliderHeight);

	ix += qs->width();
	ToolTipString = MixPtr->name();
//.........这里部分代码省略.........
开发者ID:kthxbyte,项目名称:KDE1-Linaro,代码行数:101,代码来源:kmix.cpp

示例8: cloudAntimation

void FCenterWindow::cloudAntimation(animation_Direction direction)
{
    QLabel* circle = new QLabel(stackWidget->currentWidget());
    QLabel* line = new QLabel(this);
    line->setObjectName(QString("AntimationLine"));
    line->resize(0, 2);
    line->show();
    #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
        circle->setPixmap(QPixmap::grabWidget(stackWidget->widget(preindex), stackWidget->widget(preindex)->geometry()));
    #else
        circle->setPixmap(stackWidget->widget(preindex)->grab());
    #endif

//    circle->setScaledContents(true);
    circle->show();
    circle->resize(stackWidget->currentWidget()->size());
    QPropertyAnimation *animation = new QPropertyAnimation(circle, "geometry");

    animation->setDuration(500);
    animation->setStartValue(circle->geometry());

//    QPropertyAnimation* animation_line = new QPropertyAnimation(line, "size");
//    animation_line->setDuration(500);
//    animation_line->setEasingCurve(QEasingCurve::OutQuart);

    switch (direction) {
    case animationTop:
        animation->setEndValue(QRect(circle->x(), circle->y() - 10, circle->width(), 0));
        break;
    case animationTopRight:
        animation->setEndValue(QRect(circle->width(), 0, 0, 0));
        break;
    case animationRight:
        line->move(0, stackWidget->y() - 2);
        animation->setEndValue(QRect(circle->width() + 3, 0, 0, circle->height()));
//        animation_line->setStartValue(QSize(0, 2));
//        animation_line->setEndValue(QSize(stackWidget->width(), 2));
        break;
    case animationBottomRight:
        animation->setEndValue(QRect(circle->width(), circle->height(), 0, 0));
        break;
    case animationBottom:
        animation->setEndValue(QRect(0, circle->height() + 10, circle->width(), 0));
        break;
    case animationBottomLeft:
        animation->setEndValue(QRect(0, circle->height(), 0, 0));
        break;
    case animationLeft:
        animation->setEndValue(QRect(-3, 0, 0, circle->height()));
        line->move(stackWidget->x(), stackWidget->y() - 2);
//        animation_line->setStartValue(QSize(0, 2));
//        animation_line->setEndValue(QSize(stackWidget->width(), 2));
        break;
    case animationTopLeft:
        animation->setEndValue(QRect(0, 0, 0, 0));
        break;
    case animationCenter:
        animation->setEndValue(QRect(circle->width()/2, circle->height()/2, 0, 0));
        break;
    default:
        break;
    }
    animation->setEasingCurve(QEasingCurve::OutQuart);

    QPropertyAnimation* animation_opacity = new QPropertyAnimation(circle, "windowOpacity");
    animation_opacity->setDuration(500);
    animation_opacity->setStartValue(1);
    animation_opacity->setEndValue(0);
    animation_opacity->setEasingCurve(QEasingCurve::OutQuart);

    QParallelAnimationGroup *group = new QParallelAnimationGroup;

    connect(group,SIGNAL(finished()), circle, SLOT(hide()));
    connect(group,SIGNAL(finished()), circle, SLOT(deleteLater()));
    connect(group,SIGNAL(finished()), line, SLOT(deleteLater()));
    connect(group,SIGNAL(finished()), group, SLOT(deleteLater()));
    connect(group,SIGNAL(finished()), animation, SLOT(deleteLater()));
    connect(group,SIGNAL(finished()), animation_opacity, SLOT(deleteLater()));
//    connect(group,SIGNAL(finished()), animation_line, SLOT(deleteLater()));
    group->addAnimation(animation);
    group->addAnimation(animation_opacity);
//    group->addAnimation(animation_line);
    group->start();
}
开发者ID:ben01122,项目名称:MvGather,代码行数:84,代码来源:fcenterwindow.cpp

示例9: file

TimeProfilerWindow::TimeProfilerWindow(Foundation::Framework *fw) : framework_(fw)
{
    QUiLoader loader;
    QFile file("./data/ui/profiler.ui");
    file.open(QFile::ReadOnly);
    contents_widget_ = loader.load(&file, this);
    assert(contents_widget_);
    file.close();

    QVBoxLayout *layout = new QVBoxLayout;
    assert(layout);
    layout->addWidget(contents_widget_);
    layout->setContentsMargins(0,0,0,0);
    setLayout(layout);

    tree_profiling_data_ = findChild<QTreeWidget*>("treeProfilingData");
    combo_timing_refresh_interval_ = findChild<QComboBox*>("comboTimingRefreshInterval");
    tab_widget_ = findChild<QTabWidget*>("tabWidget");
    label_frame_time_history_ = findChild<QLabel*>("labelFrameTimeHistory");
    label_top_frame_time_ = findChild<QLabel*>("labelTopFrameTime");
    label_time_per_frame_ = findChild<QLabel*>("labelTimePerFrame");
    assert(tab_widget_);
    assert(tree_profiling_data_);
    assert(combo_timing_refresh_interval_);
    assert(label_frame_time_history_);
    assert(label_top_frame_time_);

    // Create a QImage object and set it in label.
    QImage frameTimeHistory(label_frame_time_history_->width(), label_frame_time_history_->height(), QImage::Format_RGB32);
    frameTimeHistory.fill(0xFF000000);
    label_frame_time_history_->setPixmap(QPixmap::fromImage(frameTimeHistory));

    QLabel *label = findChild<QLabel*>("labelDataInSecGraph");
    QImage img(label->width(), label->height(), QImage::Format_RGB32);
    img.fill(0xFF000000);
    label->setPixmap(QPixmap::fromImage(img));

    label = findChild<QLabel*>("labelDataOutSecGraph");
    img = QImage(label->width(), label->height(), QImage::Format_RGB32);
    img.fill(0xFF000000);
    label->setPixmap(QPixmap::fromImage(img));

    label = findChild<QLabel*>("labelPacketsInSecGraph");
    img = QImage(label->width(), label->height(), QImage::Format_RGB32);
    img.fill(0xFF000000);
    label->setPixmap(QPixmap::fromImage(img));

    label = findChild<QLabel*>("labelPacketsOutSecGraph");
    img = QImage(label->width(), label->height(), QImage::Format_RGB32);
    img.fill(0xFF000000);
    label->setPixmap(QPixmap::fromImage(img));

    const int headerHeight = tree_profiling_data_->headerItem()->sizeHint(0).height();

    tree_profiling_data_->header()->resizeSection(0, 300);
    tree_profiling_data_->header()->resizeSection(1, 60);
    tree_profiling_data_->header()->resizeSection(2, 50);
    tree_profiling_data_->header()->resizeSection(3, 50);
    tree_profiling_data_->header()->resizeSection(4, 50);

    QObject::connect(tab_widget_, SIGNAL(currentChanged(int)), this, SLOT(OnProfilerWindowTabChanged(int)));

    label_region_map_coords_ = findChild<QLabel*>("labelRegionMapCoords");
    label_region_object_capacity_ = findChild<QLabel*>("labelRegionObjectCapacity");
    tree_sim_stats_ = findChild<QTreeWidget*>("treeSimStats");
    label_pid_stat_ = findChild<QLabel*>("labelPidStat");
    assert(label_pid_stat_);
    assert(label_region_map_coords_);
    assert(label_region_object_capacity_);
    assert(tree_sim_stats_);

    tree_sim_stats_->header()->resizeSection(0, 400);
    tree_sim_stats_->header()->resizeSection(1, 100);

    show_profiler_tree_ = false;
    show_unused_ = false;

    push_button_toggle_tree_ = findChild<QPushButton*>("pushButtonToggleTree");
    push_button_collapse_all_ = findChild<QPushButton*>("pushButtonCollapseAll");
    push_button_expand_all_ = findChild<QPushButton*>("pushButtonExpandAll");
    push_button_show_unused_ = findChild<QPushButton*>("pushButtonShowUnused");
    assert(push_button_toggle_tree_);
    assert(push_button_collapse_all_);
    assert(push_button_expand_all_);
    assert(push_button_show_unused_);

    tree_asset_cache_ = findChild<QTreeWidget*>("treeAssetCache");
    tree_asset_transfers_ = findChild<QTreeWidget*>("treeAssetTransfers");
    assert(tree_asset_cache_);
    assert(tree_asset_transfers_);
    tree_asset_cache_->header()->resizeSection(1, 60);
    tree_asset_transfers_->header()->resizeSection(0, 240);
    tree_asset_transfers_->header()->resizeSection(1, 90);
    tree_asset_transfers_->header()->resizeSection(2, 90);
    
   QObject::connect(push_button_toggle_tree_, SIGNAL(pressed()), this, SLOT(ToggleTreeButtonPressed()));
   QObject::connect(push_button_collapse_all_, SIGNAL(pressed()), this, SLOT(CollapseAllButtonPressed()));
   QObject::connect(push_button_expand_all_, SIGNAL(pressed()), this, SLOT(ExpandAllButtonPressed()));
   QObject::connect(push_button_show_unused_, SIGNAL(pressed()), this, SLOT(ShowUnusedButtonPressed()));

//.........这里部分代码省略.........
开发者ID:Belsepubi,项目名称:naali,代码行数:101,代码来源:TimeProfilerWindow.cpp

示例10: eventFilter

bool Lotus::eventFilter(QObject *obj, QEvent *event)
{
    if(obj == ui->btn_min){                          //最小化、最大化、关闭按钮换图
        if(event->type() == QEvent::Enter){
            ui->btn_min->setPixmap(QPixmap(":/pixmap/image/miniButton-hover.png"));
        }else if(event->type() == QEvent::Leave){
            ui->btn_min->setPixmap(QPixmap(":/pixmap/image/miniButton.png"));
        }else if(event->type() == QEvent::MouseButtonPress){
            ui->btn_min->setPixmap(QPixmap(":/pixmap/image/miniButton-hover.png"));
        }else if(event->type() == QEvent::MouseButtonRelease){
            QMouseEvent *me = (QMouseEvent *)event;
            QLabel *lb = (QLabel *)obj;
            if(me->x() > 0 && me->x() < lb->width() && me->y() > 0 && me->y() < lb->height()){
                //this->showMinimized();
                this->hide();
            }else{
                ui->btn_min->setPixmap(QPixmap(":/pixmap/image/miniButton.png"));
            }
        } else {
            return QObject::eventFilter(obj, event);
        }
        return false;
    }
    if(obj == ui->btn_close){                          //最小化、最大化、关闭按钮换图
        if(event->type() == QEvent::Enter){
            ui->btn_close->setPixmap(QPixmap(":/pixmap/image/closeButton-hover.png"));
        }else if(event->type() == QEvent::Leave){
            ui->btn_close->setPixmap(QPixmap(":/pixmap/image/closeButton.png"));
        }else if(event->type() == QEvent::MouseButtonPress){
            ui->btn_close->setPixmap(QPixmap(":/pixmap/image/closeButton-hover.png"));
        }else if(event->type() == QEvent::MouseButtonRelease){
            QMouseEvent *me = (QMouseEvent *)event;
            QLabel *lb = (QLabel *)obj;
            if(me->x() > 0 && me->x() < lb->width() && me->y() > 0 && me->y() < lb->height()){
                exitEvent();
            }else{
                ui->btn_close->setPixmap(QPixmap(":/pixmap/image/closeButton.png"));
            }
        } else {
            return QObject::eventFilter(obj, event);
        }
        return false;
    }

    if(obj==ui->avatar)
    {
        if(event->type() == QEvent::MouseButtonDblClick)
        {
            //qDebug()<<"click avatar";
            emit clickAvatarLabel();
        }
        return false;
    }
    if(obj==ui->aboutButton)
    {
        if(event->type() == QEvent::MouseButtonRelease)
        {
            //qDebug()<<"click avatar";
            clickAboutButton();
        }
        return false;
    }
    if(obj==systemTrayIcon)
    {
        if(event->type() == QEvent::MouseButtonPress||event->type() == QEvent::MouseButtonRelease)
        {
            qDebug()<<"systemTrayIcon systemTrayIcon";
            this->showNormal();
        }
        return false;
    }
    if(obj==ui->friendLabel||obj==ui->roomLabel||obj==ui->otherLabel)
    {
        if(event->type() == QEvent::MouseButtonRelease)
        {
            setWindowOpacity(1);
        }
        return false;
    }
    if(obj==ui->searchButton)
    {
        if(event->type() == QEvent::MouseButtonPress)
        {
            QMouseEvent *me = (QMouseEvent *)event;
            dragPos = me->globalPos() - frameGeometry().topLeft();
        }else if(event->type() == QEvent::MouseButtonRelease)
        {
            setWindowOpacity(1);
        }
        return false;
    }
    if(event->type() == QEvent::Enter){

         qDebug()<<"eventFilter~~~~Enter";
         if(lotusStatus==-1){
             if(topHide==true){
         topHideAnimation->setStartValue(QSize( lotusWidth,this->size().height()));
         topHideAnimation->setEndValue(QSize( lotusWidth, lotusHeight));
         topHideAnimation->start();
         lotusStatus=1;
//.........这里部分代码省略.........
开发者ID:zhangchao1987,项目名称:Lotus,代码行数:101,代码来源:lotus_event.cpp


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