Example #1
0
/**
 * @param x x coordinate
 * @param y y coordinate
 */
void CanvasView::moveDrag(int x, int y)
{
	const int dx = _dragx - x;
	const int dy = _dragy - y;

	if(_isdragging==DRAG_ROTATE) {
		qreal preva = qAtan2( width()/2 - _dragx, height()/2 - _dragy );
		qreal a = qAtan2( width()/2 - x, height()/2 - y );
		setRotation(rotation() + qRadiansToDegrees(preva-a));

	} else if(_isdragging==DRAG_ZOOM) {
		if(dy!=0) {
			float delta = qBound(-1.0, dy / 100.0, 1.0);
			if(delta>0) {
				setZoom(_zoom * (1+delta));
			} else if(delta<0) {
				setZoom(_zoom / (1-delta));
			}
		}
	} else if(_isdragging==DRAG_QUICKADJUST1) {
		if(dy!=0) {
			float delta = qBound(-2.0, dy / 10.0, 2.0);
			doQuickAdjust1(delta);
		}
	} else {
		QScrollBar *ver = verticalScrollBar();
		ver->setSliderPosition(ver->sliderPosition()+dy);
		QScrollBar *hor = horizontalScrollBar();
		hor->setSliderPosition(hor->sliderPosition()+dx);
	}

	_dragx = x;
	_dragy = y;
}
Example #2
0
void ChatWindow::notificationClicked() {
    if (parentWidget()->isMinimized()) {
        parentWidget()->showNormal();
    }
    if (isHidden()) {
        show();
    }

    // find last mention
    int messageCount = ui->messagesVBoxLayout->count();
    for (unsigned int i = messageCount; i > 0; i--) {
        ChatMessageArea* area = (ChatMessageArea*)ui->messagesVBoxLayout->itemAt(i - 1)->widget();
        QRegularExpression usernameMention(mentionRegex.arg(AccountManager::getInstance().getAccountInfo().getUsername()));
        if (area->toPlainText().contains(usernameMention)) {
            int top = area->geometry().top();
            int height = area->geometry().height();

            QScrollBar* verticalScrollBar = ui->messagesScrollArea->verticalScrollBar();
            verticalScrollBar->setSliderPosition(top - verticalScrollBar->size().height() + height);
            return;
        }
    }
    Application::processEvents();

    scrollToBottom();
}
void KeErrorText::showErrorMessage(const QString &str, int error)
{
    QString htmlStr =  QTime::currentTime().toString() + " : " + str;
    stringToHtmlFilter(htmlStr);
    switch (error){
    case EMsg_Info:
        stringToHtml(htmlStr,QColor(Qt::black));
        break;
    case EMsg_Warning:
        stringToHtml(htmlStr,QColor(Qt::darkMagenta));
        break;
    case EMsg_Error:
        stringToHtml(htmlStr,QColor(Qt::red));
        break;
    }
    QTextCursor cursor =  this->textCursor();
    cursor.movePosition(QTextCursor::End);
    this->setTextCursor(cursor);

    this->insertHtml(htmlStr);
    this->insertHtml("<br>");

    QScrollBar* scrollbar = this->verticalScrollBar();
    scrollbar->setSliderPosition(scrollbar->maximum());

}
Example #4
0
void DashBoard::printLine( const QString& line )
{
    infoViewer->append( line ) ;

    QScrollBar *scrollbar = infoViewer->verticalScrollBar();
    scrollbar->setSliderPosition(scrollbar->maximum());
}
Example #5
0
void
TabsView::showTab( TabsItem *tab )
{
    if( tab )
    {
        QString tabText = tab->getTabData();
        if( tabText.length() > 0 )
        {
            tabText.replace( "\n", "<br></br>", Qt::CaseInsensitive );

            QFont tabFont( "monospace");
            tabFont.setStyleHint( QFont::Courier );
            tabFont.setStyleStrategy( QFont::PreferAntialias );
            tabFont.setWeight( QFont::Normal );
            tabFont.setPointSize( QFont().pointSize() );

            QFont headingFont( "sans-serif" );
            headingFont.setPointSize( tabFont.pointSize() + 2 );
            headingFont.setStyleHint( QFont::SansSerif );
            headingFont.setStyleStrategy( QFont::PreferAntialias );
            headingFont.setWeight( QFont::Black );
            QString linkColor = The::paletteHandler()->palette().link().color().name();
            QString textColor = The::paletteHandler()->palette().text().color().name();
            int headingWeight = 600;

            QString htmlData = "<html>";
                    htmlData += "<body style=\"font-family:'" + tabFont.family() + "';";
                    htmlData += "font-size:" + QString::number( tabFont.pointSize() ) + "pt;";
                    htmlData += "font-weight:" + QString::number( tabFont.weight() ) + ";";
                    htmlData += "color:" + textColor + ";\">";

                    // tab heading + tab source
                    htmlData += "<p><span style=\"font-family:'" + headingFont.family() + "';";
                    htmlData += "font-size:" + QString::number( headingFont.pointSize() ) + "pt;";
                    htmlData += "font-weight:" + QString::number( headingWeight ) + ";\">";
                    htmlData += tab->getTabTitle();
                    htmlData += " (" + i18n( "tab provided from: " ) + "<a href=\"" + tab->getTabUrl() + "\">";
                    htmlData += "<span style=\"text-decoration: underline; color:" + linkColor + ";\">";
                    htmlData += tab->getTabSource() + "</a>";
                    htmlData += ")</span></p>";

                    // tab data
                    htmlData += tabText + "</body></html>";

            // backup current scrollbar position
            QScrollBar *vbar = m_tabTextBrowser->nativeWidget()->verticalScrollBar();
            int scrollPosition = vbar->isVisible() ? vbar->value() : vbar->minimum();

            m_tabTextBrowser->nativeWidget()->setHtml( htmlData );

            // re-apply scrollbar position
            vbar->setSliderPosition( scrollPosition );
        }
    }
}
Example #6
0
///Generates renderObjectCollections when required, i.e.
///when re-sized, molecule altered; adjusts the vertical scrollbar,
///and paints all visible renderOjbectCollections
void RenderArea::paintEvent(QPaintEvent *)
{
  //First, let's see how big the window is and how many bases we can spanIdRole
    QFont font("Courier", 14, QFont::Normal);						//need fixed width font
    QPainter painter(viewport());
    painter.setFont(font);
    QFontMetrics fm(font);
    int charWidth   = fm.width("cagtnrlpyt") / 10;	//width of each cha
    int lineHeight  = charWidth*3;            //fm.height("cagtnrlpyt");
    int numberWidth = round(log10(pMol->sequence.length())) * charWidth + charWidth ;
    int basePerLine = (width()-numberWidth-32)/charWidth;

    int currentBase = 0;
    QString number = QString();
    QScrollBar* scrollbar = verticalScrollBar();

    //we go here and re-virtual-render everything if the window has been re-sized 
    //as well as adjusting the vertical scroll bar
    if (reSized)
    {
       float r = ((float) scrollbar->sliderPosition())/((float) totalHeight);           //get relative position of where we are
       while (!renderObjects.isEmpty()) delete renderObjects.takeFirst();		//clean up previous render Elements

       totalHeight = 0;									//clear cumulative height
       do {
         qDebug() << "---------Line----------" << currentBase;
         RenderObjectContainer* container = pMol->renderSequenceDump(NULL, currentBase,currentBase+basePerLine, charWidth);
         renderObjects.append(container);
         currentBase += basePerLine;
         totalHeight+=container->rect.height();						//measure total height of render
       } while ((currentBase + basePerLine)<(pMol->sequence.length()));

       scrollbar->setMinimum(1);							//re-set the scrollbar
       scrollbar->setMaximum(totalHeight-height()+100);					//leave a bit of room at the bottom	
       scrollbar->setPageStep(height());						//adjust the page step to the view port's size
       scrollbar->setSliderPosition(round(r*totalHeight));				//set the slider position correctly from the relative value we had stored
       scrollbar->setSingleStep(charWidth);

       reSized = false;								//label as reSized!
    } 

    //This bit paints only the renderObjectContainers above that are visible on this viewport

    int y = 1; //renderObjects.at(1)->rect.height();
    int virtualy = scrollbar->sliderPosition();

    for (int i = 0; i < renderObjects.size(); ++i)					//ok let's paint what is visible in the view-port
    {
      y+= renderObjects.at(i)->rect.height();
      if (y>=virtualy) renderObjects.at(i)->Render(&painter, numberWidth, y-virtualy); //only if visible
      if (y>(virtualy + height())) break;						//if over the edge of the view port, stop looping
    }
}
Example #7
0
void SimpleMessageStyle::onScrollAfterResize()
{
	for (QMap<QWidget*,WidgetStatus>::iterator it = FWidgetStatus.begin(); it!= FWidgetStatus.end(); ++it)
	{
		if (it->scrollStarted)
		{
			StyleViewer *view = qobject_cast<StyleViewer *>(it.key());
			QScrollBar *scrollBar = view->verticalScrollBar();
			scrollBar->setSliderPosition(scrollBar->maximum());
			it->scrollStarted = false;
		}
	}
}
Example #8
0
/**
 * @param x x coordinate
 * @param y y coordinate
 */
void EditorView::moveDrag(int x, int y)
{
    const int dx = dragx_ - x;
    const int dy = dragy_ - y;

    if(isdragging_==ROTATE) {
        qreal preva = atan2( width()/2 - dragx_, height()/2 - dragy_ );
        qreal a = atan2( width()/2 - x, height()/2 - y );
        setRotation(rotation() + (preva-a) * (180.0 / M_PI));
    } else {
        QScrollBar *ver = verticalScrollBar();
        ver->setSliderPosition(ver->sliderPosition()+dy);
        QScrollBar *hor = horizontalScrollBar();
        hor->setSliderPosition(hor->sliderPosition()+dx);
    }

    dragx_ = x;
    dragy_ = y;

    // notify of scene change
    sceneChanged();
}
Example #9
0
/**
 * @param x x coordinate
 * @param y y coordinate
 */
void CanvasView::moveDrag(int x, int y)
{
	const int dx = _dragx - x;
	const int dy = _dragy - y;

	if(_isdragging==ROTATE) {
		qreal preva = qAtan2( width()/2 - _dragx, height()/2 - _dragy );
		qreal a = qAtan2( width()/2 - x, height()/2 - y );
		setRotation(rotation() + qRadiansToDegrees(preva-a));
	} else {
		QScrollBar *ver = verticalScrollBar();
		ver->setSliderPosition(ver->sliderPosition()+dy);
		QScrollBar *hor = horizontalScrollBar();
		hor->setSliderPosition(hor->sliderPosition()+dx);
	}

	_dragx = x;
	_dragy = y;

	// notify of scene change
	sceneChanged();
}
Example #10
0
void MainWindow::onStdout()
{
    char buf[256];
    ssize_t read;

    do {
        read = ::read(pipefd[0], buf, 256);
        ui->plainTextEdit->setPlainText(ui->plainTextEdit->toPlainText().append(QByteArray(buf,read)));
    } while (read>0);

    QScrollBar *sb = ui->plainTextEdit->verticalScrollBar();
    sb->setSliderPosition(sb->maximum());
}
Example #11
0
void Main::moveDefinicio(QEvent *event)
{
	int type = event->type();
	int step,pagestep;

	QScrollBar *bar;
	bar=ui.definicio->verticalScrollBar();
	
	step=bar->singleStep();
	pagestep=bar->pageStep();

	if (type == QEvent::User+Auxiliar::KeyDown()) {
		bar->setSliderPosition(bar->sliderPosition()+step);
	}
	else if (type == QEvent::User+Auxiliar::KeyUp()) {
		bar->setSliderPosition(bar->sliderPosition()-step);
	}
	else if (type == QEvent::User+Auxiliar::KeyNextPage()) {
		bar->setSliderPosition(bar->sliderPosition()+pagestep);
	}
	else if (type == QEvent::User+Auxiliar::KeyPrevPage()) {
		bar->setSliderPosition(bar->sliderPosition()-pagestep);
	}
}
CreateProposalPayToEntry *CreateProposalDialog::addEntry() {
	CreateProposalPayToEntry *entry = new CreateProposalPayToEntry(this);
	entry->setModel(model);
	ui->entries->insertWidget(0, entry);
	connect(entry, &CreateProposalPayToEntry::removeEntry, this, &CreateProposalDialog::removeEntry);

	// Focus the field, so that entry can start immediately
	entry->clear();
	entry->setFocus();
	ui->scrollAreaWidgetContents->resize(ui->scrollAreaWidgetContents->sizeHint());
	QCoreApplication::instance()->processEvents();
	QScrollBar* bar = ui->scrollArea->verticalScrollBar();
	if (bar)
		bar->setSliderPosition(bar->maximum());
	return entry;
}
Example #13
0
MultisigAddressEntry * MultisigDialog::addPubKey()
{
    MultisigAddressEntry *entry = new MultisigAddressEntry(this);

    entry->setModel(model);
    ui->pubkeyEntries->addWidget(entry);
    connect(entry, SIGNAL(removeEntry(MultisigAddressEntry *)), this, SLOT(removeEntry(MultisigAddressEntry *)));
    updateRemoveEnabled();
    entry->clear();
    ui->scrollAreaWidgetContents->resize(ui->scrollAreaWidgetContents->sizeHint());
    QScrollBar *bar = ui->scrollArea->verticalScrollBar();
    if(bar)
        bar->setSliderPosition(bar->maximum());

    return entry;
}
Example #14
0
SendCoinsEntry * MultisigDialog::addOutput()
{
    SendCoinsEntry *entry = new SendCoinsEntry(this);

    entry->setModel(model);
    ui->outputs->addWidget(entry);
    connect(entry, SIGNAL(removeEntry(SendCoinsEntry *)), this, SLOT(removeEntry(SendCoinsEntry *)));
    connect(entry, SIGNAL(payAmountChanged()), this, SLOT(updateAmounts()));
    updateRemoveEnabled();
    entry->clear();
    ui->scrollAreaWidgetContents_3->resize(ui->scrollAreaWidgetContents_3->sizeHint());
    QScrollBar *bar = ui->scrollArea_3->verticalScrollBar();
    if(bar)
        bar->setSliderPosition(bar->maximum());

    return entry;
}
Example #15
0
void ConsoleWidget::prompt(QString text)
{
    QString text2 = text;

    moveCursor(QTextCursor::End);

    handleColor(); // change to default color

    // add space because it looks better
    text2 += " ";

    // go to new line if line isn't empty
    emptyLine();
    insertPlainText(text2);
    m_lastLine = "";
    // if we have trouble keeping viewport
    QScrollBar *sb = verticalScrollBar();
    sb->setSliderPosition(sb->maximum());

    m_prompt = text2;
}
Example #16
0
SendCoinsEntry *SendCoinsDialog::addEntry()
{
    SendCoinsEntry *entry = new SendCoinsEntry(platformStyle, this);
    entry->setModel(model);
    ui->entries->addWidget(entry);
    connect(entry, SIGNAL(removeEntry(SendCoinsEntry*)), this, SLOT(removeEntry(SendCoinsEntry*)));
    connect(entry, SIGNAL(payAmountChanged()), this, SLOT(coinControlUpdateLabels()));
    connect(entry, SIGNAL(subtractFeeFromAmountChanged()), this, SLOT(coinControlUpdateLabels()));

    // Focus the field, so that entry can start immediately
    entry->clear();
    entry->setFocus();
    ui->scrollAreaWidgetContents->resize(ui->scrollAreaWidgetContents->sizeHint());
    qApp->processEvents();
    QScrollBar* bar = ui->scrollArea->verticalScrollBar();
    if(bar)
        bar->setSliderPosition(bar->maximum());

    updateTabsAndLabels();
    return entry;
}
Example #17
0
void ClientTextEdit::scrollBarReleased() {
//    if(action == QAbstractSlider::SliderReleased) {
        QScrollBar* sb = verticalScrollBar();
        int val = sb->value()+sb->pageStep();
        int singleStep = sb->singleStep();
        qDebug() << "* singleStep is:" << singleStep;
        //int docSize = sb->maximum() - sb->minimum() + sb->pageStep();
        if(val%singleStep != 0) {
            qDebug() << "* val is:" << val;
            // here's what's left over
            int newVal = val/singleStep;
            int pixels = newVal*singleStep;
            qDebug() << "* newVal is:" << newVal;
            if(val-pixels < singleStep/2) {
                val = pixels;
            } else {
                val = pixels + singleStep;
            }
        }
        sb->setSliderPosition(val-sb->pageStep());
        qDebug() << "* set slider position to" << val;
//    }
}
Example #18
0
void LuaAVConsole :: scroll() {
	if(mScrolling) {
		QScrollBar *scrollbar = mTextEdit->verticalScrollBar();
		scrollbar->setSliderPosition(scrollbar->maximum());
	}
}
void Page_ManagePartitions::refreshPartitionView() {
    // Save vertical scroll bar value
    int scrollYValue = 0;
    QScrollBar *scrollBar = ui->PartitionView->verticalScrollBar();

    if (scrollBar)
        scrollYValue = scrollBar->value();

    // Clean up
    ui->PartitionView->clear();


    MParted::Devices devices = mparted->getDevices();
    QFont font;
    font.setBold(true);
    font.setWeight(75);

    for (int i = 0; i < devices.size(); i++) {
        MParted::Device &device = devices[i];
        QTreeWidgetItem *itemDevice = new QTreeWidgetItem();
        ui->PartitionView->addTopLevelItem(itemDevice);
        ui->PartitionView->setFirstItemColumnSpanned(itemDevice, true);

        // Set text
        QString deviceText = QString("%1 (%2, %3)").arg(device.path, device.model, device.getFormattedSize());

        if (device.unkownPartitionTable)
            deviceText += "  -  " + tr("unkown Partition Table");

        itemDevice->setText(0, deviceText);

        // Set icon
        if (device.removable)
            itemDevice->setIcon(0, QIcon(":/images/resources/removabledisk.png"));
        else
            itemDevice->setIcon(0, QIcon(":/images/resources/disk.png"));


        // Partitions
        for (int x = 0; x < device.partitions.size(); x++) {
            MParted::Partition &partition = device.partitions[x];
            QTreeWidgetItem *itemPartition = addPartitionItem(partition, itemDevice);

            // Logical partitions if present
            if (!partition.logicals.isEmpty()) {
                for (int x = 0; x < partition.logicals.size(); ++x) {
                    addPartitionItem(partition.logicals[x], itemPartition);
                }
            }
        }

        // Set up itemDevice
        itemDevice->setFont(0, font);
        itemDevice->setSizeHint(0, QSize(0, 32));
        itemDevice->setExpanded(true);
        itemDevice->setFlags(Qt::ItemIsEnabled);
    }

    // Be sure the tree widget list is filled already and that the scrollbar is visible already
    qApp->processEvents();

    // Restore vertical scroll bar value
    scrollBar = ui->PartitionView->verticalScrollBar();

    if (scrollBar && scrollYValue > 0) {
        if (scrollYValue > scrollBar->maximum())
            scrollYValue = scrollBar->maximum();

        scrollBar->setSliderPosition(scrollYValue);
    }
}
Example #20
0
 /**
  * Resize the scroll bars and center the point clicked.
  *
  */
 void StatisticsTool::resizeScrollbars() {
   QScrollBar *hbar = p_visualScroll->horizontalScrollBar();
   QScrollBar *vbar = p_visualScroll->verticalScrollBar();
   hbar->setSliderPosition((hbar->maximum() + hbar->minimum()) / 2);
   vbar->setSliderPosition((vbar->maximum() + vbar->minimum()) / 2);
 }
void BCI2000Viewer::ChannelPageNext()
{ QScrollBar* s = ui->verticalScrollBar;
  s->setSliderPosition( min( s->maximum(), s->sliderPosition() + s->pageStep() ) ); }
void BCI2000Viewer::ChannelPagePrev()
{ QScrollBar* s = ui->verticalScrollBar;
  s->setSliderPosition( max( s->minimum(), s->sliderPosition() - s->pageStep() ) ); }
Example #23
0
void MapArea::mouseMoveEvent(QMouseEvent *event)
{
	const QPoint &point = event->pos();	
	
	if( !mapInfo || !this->rect().contains(point) )
		return;

	// Move sliders
	if( event->buttons() & Qt::RightButton )
	{
		globalPoint = event->globalPos();

		QScrollBar *hSB = scrollArea->horizontalScrollBar();
		hSB->setSliderPosition(hSB->sliderPosition() - globalPoint.x() + lastGlobalPoint.x());
		QScrollBar *vSB = scrollArea->verticalScrollBar();
		vSB->setSliderPosition(vSB->sliderPosition() - globalPoint.y() + lastGlobalPoint.y());

		lastGlobalPoint = globalPoint;
	}

	const int tileX = point.x() / tileSize;
	const int tileY = point.y() / tileSize;
	const QRect &rc = QRect(tileX * tileSize, tileY * tileSize, tileSize, tileSize);

	// Draw objects, if LMB and current item is valid.
	if( (event->buttons() & Qt::LeftButton) && (mainForm->currentItem) )
	{
		isHighlight = false;		

		MapInfo::Tile &tile = mapInfo->tiles[tileY][tileX]; // On map
		const sh_p<ObjectInfo> newObj = objectFromItem[mainForm->currentItem]; // In mouse

		// *** currentItem is only from currentToolboxIndex ***

		switch( mainForm->currentToolboxIndex )
		{
			case 0: // Tools
			{
				sh_p<ObjectInfo> &obj = tile.object;
				if( obj != newObj )
				{
					AddObjectWithPainter(frontPixmap, rc, obj, newObj);
				}
			}
			break;
			case 1: // Terrain changing
			{
				sh_p<ObjectInfo> &terr = tile.terrain;
				if( terr != newObj )
				{
					AddObjectWithPainter(groundPixmap, rc, terr, newObj);
				}
			}
			break;
			case 2: // Resource add
			{
				sh_p<ObjectInfo> &obj = tile.object;
				if( obj != newObj )
				{
					AddObjectWithPainter(frontPixmap, rc, obj, newObj);
				}
			}
			break;			
		}
	}
	else // Highlight current rectangle
	{
		isHighlight = true;
	}

	// Update rects
	if( lastRc.topLeft() != rc.topLeft() )
	{
		this->update(lastRc);
		lastRc = rc;
		this->update(lastRc);
	}
}
Example #24
0
void TrackListView::populateTable()/*{{{*/
{
    if(debugMsg)
        printf("TrackListView::populateTable\n");
    QScrollBar *bar = m_table->verticalScrollBar();
    int barPos = 0;
    if(bar)
        barPos = bar->sliderPosition();

    m_model->clear();
    for(iMidiTrack i = song->artracks()->begin(); i != song->artracks()->end(); ++i)
    {
        MidiTrack* track = (MidiTrack*)(*i);
        PartList* pl = track->parts();
        if(m_displayRole == PartRole && pl->empty())
        {
            continue;
        }

        QStandardItem* trackName = new QStandardItem();
        trackName->setForeground(QBrush(QColor(205,209,205)));
        trackName->setBackground(QBrush(QColor(20,20,20)));
        trackName->setFont(QFont("fixed-width", 10, QFont::Bold));
        trackName->setText(track->name());
        trackName->setCheckable(true);
        trackName->setCheckState(m_selectedTracks.contains(track->id()) ? Qt::Checked : Qt::Unchecked);

        trackName->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
        trackName->setData(1, TrackRole);
        trackName->setData(track->name(), TrackNameRole);
        trackName->setData(track->id(), TrackIdRole);
        trackName->setEditable(true);
        m_model->appendRow(trackName);

        for(iPart ip = pl->begin(); ip != pl->end(); ++ip)
        {
            Part* part = ip->second;
            QStandardItem* partName = new QStandardItem();
            partName->setFont(QFont("fixed-width", 9, QFont::Bold));
            partName->setText(part->name());
            partName->setData(part->sn(), PartRole);
            partName->setData(2, TrackRole);
            partName->setData(track->name(), TrackNameRole);
            partName->setData(part->name(), PartNameRole);
            partName->setData(part->tick(), TickRole);
            partName->setData(track->id(), TrackIdRole);
            partName->setEditable(true);
            partName->setCheckable(true);
            partName->setCheckState(m_editor->hasPart(part->sn()) ? Qt::Checked : Qt::Unchecked);

            if(!partColorIcons.isEmpty() && part->colorIndex() < partColorIcons.size())
                partName->setIcon(partColorIcons.at(part->colorIndex()));

            m_model->appendRow(partName);
        }
    }
    m_model->setHorizontalHeaderLabels(m_headers);
    if(m_selectedIndex < m_model->rowCount())
    {
        m_table->selectRow(m_selectedIndex);
        m_table->scrollTo(m_model->index(m_selectedIndex, 0));
    }
    if(bar)
        bar->setSliderPosition(barPos);
}/*}}}*/
Example #25
0
void MainWindow::on_actionGoDowm_triggered()
{
    QScrollBar *bar = textBrowser->verticalScrollBar();
    bar->setSliderPosition(bar->maximum());
}