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


C++ QScrollBar::setValue方法代码示例

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


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

示例1: refreshLog

void HelpDialog::refreshLog() const
{
	ui->logBrowser->setPlainText(StelLogger::getLog());
	QScrollBar *sb = ui->logBrowser->verticalScrollBar();
	sb->setValue(sb->maximum());
}
开发者ID:Stellarium,项目名称:stellarium,代码行数:6,代码来源:HelpDialog.cpp

示例2:

void KTreeView::KTreeViewPrivate::updateVerticalScrollBar(int value)
{
    QScrollBar *scrollBar = parent->horizontalScrollBar();
    scrollBar->setValue(value);
}
开发者ID:vishesh,项目名称:kde-baseapps,代码行数:5,代码来源:ktreeview.cpp

示例3: paintEvent

void CtrlRegisterList::paintEvent(QPaintEvent *)
{

	int numRowsTotal = cpu->GetNumRegsInCategory(category);
	int maxRowsDisplay =rect().bottom()/rowHeight - 1;

	selection = std::min(std::max(selection,0),numRowsTotal);
	curVertOffset = std::max(std::min(curVertOffset,numRowsTotal - maxRowsDisplay),0);

	QScrollBar *bar = findChild<QScrollBar*>("RegListScroll");
	if(bar)
	{
		bar->setMinimum(0);
		bar->setMaximum(numRowsTotal - maxRowsDisplay);
		bar->setPageStep(1);
		bar->setValue(curVertOffset);
	}


	QPainter painter(this);
	painter.setBrush(Qt::white);
	painter.setPen(Qt::white);
	painter.drawRect(rect());

	if (!cpu)
		return;

	QFont normalFont = QFont("Arial", 10);
	painter.setFont(normalFont);

	int width = rect().width();

	QColor bgColor(0xffffff);
	QPen nullPen(bgColor);
	QPen currentPen(QColor(0xFF000000));
	QPen selPen(0x808080);
	QPen textPen;

	QBrush lbr;
	lbr.setColor(bgColor);
	QBrush nullBrush(bgColor);
	QBrush currentBrush(0xFFEfE8);
	QBrush pcBrush(0x70FF70);

	int nc = cpu->GetNumCategories();
	for (int i=0; i<nc; i++)
	{
		painter.setPen(i==category?currentPen:nullPen);
		painter.setBrush(i==category?pcBrush:nullBrush);
		painter.drawRect(width*i/nc,0,width*(i+1)/nc - width*i/nc -1,rowHeight-1);
		QString name = cpu->GetCategoryName(i);
		painter.setPen(currentPen);
		painter.drawText(width*i/nc+1,-3+rowHeight,name);
	}

	int numRows=rect().bottom()/rowHeight;

	for (int i=curVertOffset; i<curVertOffset+numRows; i++)
	{
		int rowY1 = rowHeight*(i-curVertOffset+1);
		int rowY2 = rowHeight*(i-curVertOffset+2)-1;

		lbr.setColor(i==selection?0xffeee0:0xffffff);

		painter.setBrush(currentBrush);
		painter.setPen(nullPen);
		painter.drawRect(0,rowY1,16-1,rowY2-rowY1);

		if (selecting && i == selection)
			painter.setPen(selPen);
		else
			painter.setPen(nullPen);

		QBrush mojsBrush(lbr.color());
		painter.setBrush(mojsBrush);

		painter.drawRect(16,rowY1,width-16-1,rowY2-rowY1);

		// Check for any changes in the registers.
		if (lastPC != cpu->GetPC())
		{
			for (int i = 0, n = cpu->GetNumRegsInCategory(0); i < n; ++i)
			{
				u32 v = cpu->GetRegValue(0, i);
				changedCat0Regs[i] = v != lastCat0Values[i];
				lastCat0Values[i] = v;
			}
			lastPC = cpu->GetPC();
		}

		painter.setBrush(currentBrush);
		if (i<cpu->GetNumRegsInCategory(category))
		{
			QString regName = cpu->GetRegName(category,i);
			textPen.setColor(0x600000);
			painter.setPen(textPen);
			painter.drawText(17,rowY1-3+rowHeight,regName);
			textPen.setColor(0xFF000000);
			painter.setPen(textPen);

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

示例4: eventFilter_QAbstractScrollArea

bool QtScrollerFilter::eventFilter_QAbstractScrollArea(QAbstractScrollArea *area, QEvent *event)
{
    switch (event->type()) {
    case QtScrollPrepareEvent::ScrollPrepare:
    {
        QtScrollPrepareEvent *se = static_cast<QtScrollPrepareEvent *>(event);
        if (canStartScrollingAt_QAbstractScrollArea(area, se->startPos().toPoint())) {
            QScrollBar *hBar = area->horizontalScrollBar();
            QScrollBar *vBar = area->verticalScrollBar();

            se->setViewportSize(QSizeF(area->viewport()->size()));
            se->setContentPosRange(QRectF(0, 0, hBar->maximum(), vBar->maximum()));
            se->setContentPos(QPointF(hBar->value(), vBar->value()));
            se->accept();
            return true;
        }
        return false;
    }
    case QtScrollEvent::Scroll:
    {
        QtScrollEvent *se = static_cast<QtScrollEvent *>(event);

        QScrollBar *hBar = area->horizontalScrollBar();
        QScrollBar *vBar = area->verticalScrollBar();
        hBar->setValue(se->contentPos().x());
        vBar->setValue(se->contentPos().y());

        QPoint os = overshoot.value(area);
#ifdef Q_WS_WIN
        typedef BOOL (*PtrBeginPanningFeedback)(HWND);
        typedef BOOL (*PtrUpdatePanningFeedback)(HWND, LONG, LONG, BOOL);
        typedef BOOL (*PtrEndPanningFeedback)(HWND, BOOL);

        static PtrBeginPanningFeedback ptrBeginPanningFeedback = 0;
        static PtrUpdatePanningFeedback ptrUpdatePanningFeedback = 0;
        static PtrEndPanningFeedback ptrEndPanningFeedback = 0;

        if (!ptrBeginPanningFeedback)
            ptrBeginPanningFeedback = (PtrBeginPanningFeedback) QLibrary::resolve(QLatin1String("UxTheme"), "BeginPanningFeedback");
        if (!ptrUpdatePanningFeedback)
            ptrUpdatePanningFeedback = (PtrUpdatePanningFeedback) QLibrary::resolve(QLatin1String("UxTheme"), "UpdatePanningFeedback");
        if (!ptrEndPanningFeedback)
            ptrEndPanningFeedback = (PtrEndPanningFeedback) QLibrary::resolve(QLatin1String("UxTheme"), "EndPanningFeedback");

        if (ptrBeginPanningFeedback && ptrUpdatePanningFeedback && ptrEndPanningFeedback) {
            WId wid = area->window()->winId();

            if (!se->overshootDistance().isNull() && os.isNull())
                ptrBeginPanningFeedback(wid);
            if (!se->overshootDistance().isNull())
                ptrUpdatePanningFeedback(wid, -se->overshootDistance().x(), -se->overshootDistance().y(), false);
            if (se->overshootDistance().isNull() && !os.isNull())
                ptrEndPanningFeedback(wid, true);
        } else
#endif
        {
            QPoint delta = os - se->overshootDistance().toPoint();
            if (!delta.isNull()) {
                ignoreMove = true;
                area->viewport()->move(area->viewport()->pos() + delta);
                ignoreMove = false;
            }
        }
        overshoot[area] = se->overshootDistance().toPoint();
        return true;
    }
    case QEvent::Move: {
        if (!ignoreMove && !overshoot.value(area).isNull()) {
            ignoreMove = true;
            area->viewport()->move(area->viewport()->pos() - overshoot.value(area));
            ignoreMove = false;
        }
        return false;
    }
    default:
        return false;
    }
}
开发者ID:AlexeyProkhin,项目名称:qutim,代码行数:78,代码来源:qtscrollerfilter.cpp

示例5: makeBlockVisible

void VMdEditor::makeBlockVisible(const QTextBlock &p_block)
{
    if (!p_block.isValid() || !p_block.isVisible()) {
        return;
    }

    QScrollBar *vbar = verticalScrollBar();
    if (!vbar || (vbar->minimum() == vbar->maximum())) {
        // No vertical scrollbar. No need to scroll.
        return;
    }

    int height = rect().height();
    QScrollBar *hbar = horizontalScrollBar();
    if (hbar && (hbar->minimum() != hbar->maximum())) {
        height -= hbar->height();
    }

    bool moved = false;

    QAbstractTextDocumentLayout *layout = document()->documentLayout();
    QRectF rect = layout->blockBoundingRect(p_block);
    int y = GETVISUALOFFSETY;
    int rectHeight = (int)rect.height();

    // Handle the case rectHeight >= height.
    if (rectHeight >= height) {
        if (y < 0) {
            // Need to scroll up.
            while (y + rectHeight < height && vbar->value() > vbar->minimum()) {
                moved = true;
                vbar->setValue(vbar->value() - vbar->singleStep());
                rect = layout->blockBoundingRect(p_block);
                rectHeight = (int)rect.height();
                y = GETVISUALOFFSETY;
            }
        } else if (y > 0) {
            // Need to scroll down.
            while (y > 0 && vbar->value() < vbar->maximum()) {
                moved = true;
                vbar->setValue(vbar->value() + vbar->singleStep());
                rect = layout->blockBoundingRect(p_block);
                rectHeight = (int)rect.height();
                y = GETVISUALOFFSETY;
            }

            if (y < 0) {
                // One step back.
                moved = true;
                vbar->setValue(vbar->value() - vbar->singleStep());
            }
        }

        if (moved) {
            qDebug() << "scroll to make huge block visible";
        }

        return;
    }

    while (y < 0 && vbar->value() > vbar->minimum()) {
        moved = true;
        vbar->setValue(vbar->value() - vbar->singleStep());
        rect = layout->blockBoundingRect(p_block);
        rectHeight = (int)rect.height();
        y = GETVISUALOFFSETY;
    }

    if (moved) {
        qDebug() << "scroll page down to make block visible";
        return;
    }

    while (y + rectHeight > height && vbar->value() < vbar->maximum()) {
        moved = true;
        vbar->setValue(vbar->value() + vbar->singleStep());
        rect = layout->blockBoundingRect(p_block);
        rectHeight = (int)rect.height();
        y = GETVISUALOFFSETY;
    }

    if (moved) {
        qDebug() << "scroll page up to make block visible";
    }
}
开发者ID:vscanf,项目名称:vnote,代码行数:85,代码来源:vmdeditor.cpp

示例6: onSliderRangeChanged

void GroupChatForm::onSliderRangeChanged()
{
    QScrollBar* scroll = chatArea->verticalScrollBar();
    if (lockSliderToBottom)
         scroll->setValue(scroll->maximum());
}
开发者ID:ReDetection,项目名称:qTox,代码行数:6,代码来源:groupchatform.cpp

示例7: UpdateUI


//.........这里部分代码省略.........

		// Limit processing time
		if (steady_clock::now() >= start + 4ms || buf.empty()) break;
	}

	// Check main logs
	while (const auto packet = s_gui_listener.read->next.load())
	{
		// Confirm log level
		if (packet->sev <= s_gui_listener.enabled)
		{
			QString text;
			switch (packet->sev)
			{
			case logs::level::always: break;
			case logs::level::fatal: text = "F "; break;
			case logs::level::error: text = "E "; break;
			case logs::level::todo: text = "U "; break;
			case logs::level::success: text = "S "; break;
			case logs::level::warning: text = "W "; break;
			case logs::level::notice: text = "! "; break;
			case logs::level::trace: text = "T "; break;
			default: continue;
			}

			// Print UTF-8 text.
			text += qstr(packet->msg);

			// save old log state
			QScrollBar *sb = m_log->verticalScrollBar();
			bool isMax = sb->value() == sb->maximum();
			int sb_pos = sb->value();
			int sel_pos = m_log->textCursor().position();
			int sel_start = m_log->textCursor().selectionStart();
			int sel_end = m_log->textCursor().selectionEnd();

			// clear selection or else it will get colorized as well
			QTextCursor c = m_log->textCursor();
			c.clearSelection();
			m_log->setTextCursor(c);

			// remove the new line because Qt's append adds a new line already.
			text.chop(1);

			QString suffix;
			bool isSame = text == m_old_text;

			// create counter suffix and remove recurring line if needed
			if (m_stack_log)
			{
				if (isSame)
				{
					m_log_counter++;
					suffix = QString(" x%1").arg(m_log_counter);
					m_log->moveCursor(QTextCursor::End, QTextCursor::MoveAnchor);
					m_log->moveCursor(QTextCursor::StartOfBlock, QTextCursor::MoveAnchor);
					m_log->moveCursor(QTextCursor::End, QTextCursor::KeepAnchor);
					m_log->textCursor().removeSelectedText();
					m_log->textCursor().deletePreviousChar();
				}
				else
				{
					m_log_counter = 1;
					m_old_text = text;
				}
			}

			// add actual log message
			m_log->setTextColor(m_color[static_cast<int>(packet->sev)]);
			m_log->append(text);

			// add counter suffix if needed
			if (m_stack_log && isSame)
			{
				m_log->setTextColor(m_color_stack);
				m_log->insertPlainText(suffix);
			}

			// if we mark text from right to left we need to swap sides (start is always smaller than end)
			if (sel_pos < sel_end)
			{
				std::swap(sel_start, sel_end);
			}

			// reset old text cursor and selection
			c.setPosition(sel_start);
			c.setPosition(sel_end, QTextCursor::KeepAnchor);
			m_log->setTextCursor(c);

			// set scrollbar to max means auto-scroll
			sb->setValue(isMax ? sb->maximum() : sb_pos);
		}

		// Drop packet
		s_gui_listener.pop();

		// Limit processing time
		if (steady_clock::now() >= start + 7ms) break;
	}
}
开发者ID:DHrpcs3,项目名称:rpcs3,代码行数:101,代码来源:log_frame.cpp

示例8: appendToLog

void MainWindow::appendToLog(QString msg)
{
    ui->parsedOutputPlainTextEdit->appendPlainText(msg);
    QScrollBar *scrollbar = ui->parsedOutputPlainTextEdit->verticalScrollBar();
    scrollbar->setValue(scrollbar->maximum());
}
开发者ID:Yuvin,项目名称:dash7-ap-open-source-stack,代码行数:6,代码来源:mainwindow.cpp

示例9: addText

void LogViewer::addText(const QString &text, int textType)
{
    QString typeStr;
    QString stringToAdd = "";
    moveCursor(QTextCursor::End);
    switch (textType)
    {
        case LogInfo:
            setTextColor( Qt::black );
            //typeStr = "[info ] ";
            typeStr = "";
            break;
        case LogWarn:
            setTextColor( QColor(100,100, 0) );
            //typeStr = "[warn] ";
            typeStr = "";
            break;
        case LogErr:
            setTextColor( Qt::red );
            //typeStr = "[error] ";
            typeStr = "";
            break;
        case LogThreadId:
            setTextColor( QColor(100,100,100) );
            //typeStr = "[thread ] ";
            typeStr = "";
            break;
        case LogTx:
            setTextColor( Qt::blue );
            //typeStr = "[tx   ] ";
            typeStr = "<< ";
            break;
        case LogRx:
            setTextColor( QColor(150,0,255) );
            //typeStr = "[rx   ] ";
            typeStr = ">> ";
            break;
        default:
        setTextColor( Qt::black );
        typeStr = "";
    }

    if ((lastTextType == LogTx) || (lastTextType == LogRx))
    {
        if (textType != lastTextType)
        {
            stringToAdd.append("\r");
            stringToAdd.append(typeStr);
        }
    }
    else
    {
        stringToAdd.append(typeStr);
    }

    stringToAdd.append(text);
    if (!((textType == LogTx) || (textType == LogRx)))
        stringToAdd.append("\r");
    textCursor().insertText(stringToAdd);
    lastTextType = textType;
    QScrollBar *bar = verticalScrollBar();
    bar->setValue(bar->maximum());
}
开发者ID:Avegawanderer,项目名称:mdr32f9q-ps200w,代码行数:63,代码来源:logviewer.cpp

示例10: scrollDown

void RKProgressControlDialog::scrollDown () {
	RK_TRACE (MISC);

	QScrollBar *bar = output_text->verticalScrollBar ();
	if (bar) bar->setValue (bar->maximum ());
}
开发者ID:KDE,项目名称:rkward,代码行数:6,代码来源:rkprogresscontrol.cpp

示例11: scrollDown

void ScriptConsoleView::scrollDown()
{
    QScrollBar *scroll = m_ui->commandsList->verticalScrollBar();
    scroll->setValue(scroll->maximum());
}
开发者ID:yudjin87,项目名称:tour_du_monde,代码行数:5,代码来源:ScriptConsoleView.cpp

示例12: keyPressEvent

void Console::keyPressEvent(QKeyEvent *e) {
    if (locked)
        return;

    if ((e->key() == Qt::Key_V && e->modifiers() == Qt::ControlModifier))
        QTextEdit::keyPressEvent(e);
    else if (e->key() >= Qt::Key_Space && e->key() <= Qt::Key_BraceRight && e->key() != Qt::Key_QuoteLeft) {
        if (e->modifiers() == Qt::NoModifier || e->modifiers() == Qt::ShiftModifier)
            QTextEdit::keyPressEvent(e);
    }

    else
        switch (e->key()) {
        case Qt::Key_Return:
            onReturn();
            break;

        case Qt::Key_Up:
            historyBack();
            break;
        case Qt::Key_Down:
            historyForward();
            break;

        case Qt::Key_Backspace:
            if (textCursor().positionInBlock() > prompt.length())
                QTextEdit::keyPressEvent(e);
            break;

        case Qt::Key_End:
        case Qt::Key_Delete:
            QTextEdit::keyPressEvent(e);
            break;

        case Qt::Key_Left:
            if (e->modifiers() == Qt::NoModifier) {
                QTextEdit::keyPressEvent(e);

                QTextCursor cursor = textCursor();

                if (cursor.positionInBlock() < prompt.length())
                    cursor.movePosition(QTextCursor::Right, QTextCursor::MoveAnchor);

                setTextCursor(cursor);
            } else if (e->modifiers() == Qt::ControlModifier) {
                QTextEdit::keyPressEvent(e);

                QTextCursor cursor = textCursor();

                if (cursor.positionInBlock() < prompt.length())
                    cursor.movePosition(QTextCursor::Right, QTextCursor::MoveAnchor, 2);

                setTextCursor(cursor);
            }
            break;

        case Qt::Key_Right:
            if (e->modifiers() == Qt::NoModifier || e->modifiers() == Qt::ControlModifier)
                QTextEdit::keyPressEvent(e);
            break;

        case Qt::Key_Home: {
            QTextCursor cursor = textCursor();
            cursor.movePosition(QTextCursor::StartOfBlock);
            cursor.movePosition(QTextCursor::Right, QTextCursor::MoveAnchor, prompt.length());
            setTextCursor(cursor);
        } break;

        //    case Qt::Key_PageUp:
        //    case Qt::Key_PageDown:
        //    {
        //        QTextEdit::keyPressEvent(e);

        //        QTextCursor cursor = textCursor();
        //        cursor.movePosition(QTextCursor::End);
        //        setTextCursor(cursor);
        //    } break;

        case Qt::Key_PageUp: {
            QScrollBar *vbar = verticalScrollBar();
            vbar->setValue(vbar->value() - 15);
        } break;

        case Qt::Key_PageDown: {
            QScrollBar *vbar = verticalScrollBar();
            vbar->setValue(vbar->value() + 15);
        } break;

        //    case Qt::Key_Escape:
        //    {
        //        QTextCursor cursor = textCursor();
        //        cursor.movePosition(QTextCursor::StartOfBlock);
        //        cursor.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor);
        //        cursor.removeSelectedText();

        //        insertPrompt();
        //    } break;

        default:
            QWidget::keyPressEvent(e);
//.........这里部分代码省略.........
开发者ID:ArthurGoodman,项目名称:raygl,代码行数:101,代码来源:console.cpp

示例13: initStyleOption


//.........这里部分代码省略.........
            if (opt->singleStep)
            {
                qreal numOfSteps = (opt->maximum - opt->minimum) / opt->singleStep;

                // at least 5 pixels between tick marks
                if (numOfSteps && (width() / numOfSteps < 5))
                    opt->tickInterval = qRound((5*numOfSteps / width()) + 0.5)*step();
                else
                    opt->tickInterval = opt->singleStep;
            }
            else // default Qt-components implementation
                opt->tickInterval = opt->maximum != opt->minimum ? 1200 / (opt->maximum - opt->minimum) : 0;

            if (style() == QLatin1String("oxygen") && type == QLatin1String("dial"))
                opt->sliderValue  = maximum() - value();
            else
                opt->sliderValue = value();
            opt->subControls = QStyle::SC_SliderGroove | QStyle::SC_SliderHandle;
            opt->tickPosition = (activeControl() == "below") ?
                                QSlider::TicksBelow : (activeControl() == "above" ?
                                                       QSlider::TicksAbove:
                                                       QSlider::NoTicks);
            if (opt->tickPosition != QSlider::NoTicks)
                opt->subControls |= QStyle::SC_SliderTickmarks;

            opt->activeSubControls = QStyle::SC_None;
        }
        break;
    case ProgressBar: {
            if (QProgressBar *bar= qobject_cast<QProgressBar*>(widget())){
                bar->setMaximum(maximum());
                bar->setMinimum(minimum());
                if (maximum() != minimum())
                    bar->setValue(1);
            }
            if (!m_styleoption)
                m_styleoption = new QStyleOptionProgressBarV2();

            QStyleOptionProgressBarV2 *opt = qstyleoption_cast<QStyleOptionProgressBarV2*>(m_styleoption);
            opt->orientation = horizontal() ? Qt::Horizontal : Qt::Vertical;
            opt->minimum = minimum();
            opt->maximum = maximum();
            opt->progress = value();
        }
        break;
    case GroupBox: {
            if (!m_styleoption)
                m_styleoption = new QStyleOptionGroupBox();

            QStyleOptionGroupBox *opt = qstyleoption_cast<QStyleOptionGroupBox*>(m_styleoption);
            opt->text = text();
            opt->lineWidth = 1;
            opt->subControls = QStyle::SC_GroupBoxLabel;
            if (sunken()) // Qt draws an ugly line here so I ignore it
                opt->subControls |= QStyle::SC_GroupBoxFrame;
            else
                opt->features |= QStyleOptionFrameV2::Flat;
            if (activeControl() == "checkbox")
                opt->subControls |= QStyle::SC_GroupBoxCheckBox;

            if (QGroupBox *group= qobject_cast<QGroupBox*>(widget())) {
                group->setTitle(text());
                group->setCheckable(opt->subControls & QStyle::SC_GroupBoxCheckBox);
            }
        }
        break;
开发者ID:CNOT,项目名称:julia-studio,代码行数:67,代码来源:qstyleitem.cpp

示例14: onSliderRangeChanged

void ChatAreaWidget::onSliderRangeChanged()
{
    QScrollBar* scroll = verticalScrollBar();
    if (lockSliderToBottom)
        scroll->setValue(scroll->maximum());
}
开发者ID:rokups,项目名称:qTox,代码行数:6,代码来源:chatareawidget.cpp

示例15: processFinished

void MainWindow::processFinished( int exitCode, QProcess::ExitStatus exitStatus)
{
    if ( exitStatus == QProcess::CrashExit )
    {
//        QMessageBox::warning( this, tr("Error"), tr("Crashed") );
        cnvOutputStr = cnvOutputStr + "Error:" + ui->listWidget->item(convet_index-1)->text();
        convert_error = true;
    }
    else if ( exitCode != 0 )
    {
//        QMessageBox::warning( this, tr("Error"), tr("Failed") );
        cnvOutputStr = cnvOutputStr + "Error:" + ui->listWidget->item(convet_index-1)->text();
        convert_error = true;
    }
    else
    {
        // 正常終了時の処理
//        ui->textBrowser_status->setText(tr("Convert Success!"));
//    QMessageBox::information(this, tr("Ss5Converter"), tr("Convert success"));
    }

    if (( ui->listWidget->count() > convet_index ))
    {
        QString st = QString("Exec %1/%2").arg(convet_index+1).arg(ui->listWidget->count());
        ui->textBrowser_status->setText(st);     //ステータス
        {
            QString fileName = ui->listWidget->item(convet_index)->text();
            //コンバータの起動
            if (fileName.isEmpty())
            {
                //ファイル名なし
            }
            else
            {
                QString str;
                QString execstr;

        #ifdef Q_OS_WIN32
                // Windows
                execstr = "Ss5Converter.exe";
        #else
                // Mac
                QDir dir = QDir(execPathStr);
                dir.cd("..");
                dir.cd("..");
                dir.cd("..");
                dir.cd("..");
                QString str_current_path = dir.path();
                execstr = str_current_path + "/Ss5Converter";
        #endif
                str = execstr + " \"" + fileName + "\"";
                cnvProcess->start(str); //パスと引数

                convet_index++;
            }
        }
    }
    else
    {
        button_enable(true);
        convert_exec = false;  //コンバート中か
        if ( convert_error == false )
        {
            ui->textBrowser_status->setText(tr("Convert Success!"));
        }
        else
        {
            ui->textBrowser_status->setText(tr("Error"));   //ステータス
            ui->textBrowser_err->setText(cnvOutputStr);
        }
    }
    //カーソルを最終行へ移動
    QScrollBar *sb = ui->textBrowser_err->verticalScrollBar();
    sb->setValue(sb->maximum());

}
开发者ID:SpriteStudio,项目名称:SpriteStudio5-SDK,代码行数:76,代码来源:mainwindow.cpp


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