Esempio n. 1
0
void TextShow::resizeEvent(QResizeEvent *e)
{
#ifdef WIN32
	if (inResize()){
		if (!m_timer->isActive()){
			setHScrollBarMode(AlwaysOff);
			setVScrollBarMode(AlwaysOff);
			m_timer->start(100);
		}
		return;
	}
#endif
    QPoint p = QPoint(0, height());
    p = mapToGlobal(p);
    p = viewport()->mapFromGlobal(p);
    int x, y;
    viewportToContents(p.x(), p.y(), x, y);
	int para;
    int pos = charAt(QPoint(x, y), &para);
    QTextEdit::resizeEvent(e);
    if (pos == -1){
        scrollToBottom();
    }else{
        setCursorPosition(para, pos);
        ensureCursorVisible();
    }
	sync();
	viewport()->repaint();
}
Esempio n. 2
0
void TextShow::slotResizeTimer()
{
#ifdef WIN32
	if (inResize())
		return;
	m_timer->stop();
	setVScrollBarMode(Auto);
	setHScrollBarMode(Auto);
	QResizeEvent re(QSize(0, 0), size());
	resizeEvent(&re);
#endif
}
Esempio n. 3
0
void ListView::adjustColumn()
{
#ifdef WIN32
    if (inResize()){
        if (!m_resizeTimer->isActive())
            m_resizeTimer->start(500);
        return;
    }
#endif
    m_resizeTimer->stop();
    if (m_expandingColumn >= 0){
        int w = width();
        QScrollBar *vBar = verticalScrollBar();
        if (vBar->isVisible())
            w -= vBar->width();
        for (int i = 0; i < columnCount(); i++){
            if (i == m_expandingColumn)
                continue;
            w -= columnWidth(i);
        }
        resizeColumnToContents(m_expandingColumn);
        viewport()->repaint();
    }
}