A<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://www.cppe.ru/index.php?action=history&amp;feed=atom&amp;title=C%2B%2B%2FQt%2FQSplitter</id>
		<title>C++/Qt/QSplitter - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://www.cppe.ru/index.php?action=history&amp;feed=atom&amp;title=C%2B%2B%2FQt%2FQSplitter"/>
		<link rel="alternate" type="text/html" href="http://www.cppe.ru/index.php?title=C%2B%2B/Qt/QSplitter&amp;action=history"/>
		<updated>2026-04-18T22:13:47Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://www.cppe.ru/index.php?title=C%2B%2B/Qt/QSplitter&amp;diff=1142&amp;oldid=prev</id>
		<title> в 14:21, 25 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://www.cppe.ru/index.php?title=C%2B%2B/Qt/QSplitter&amp;diff=1142&amp;oldid=prev"/>
				<updated>2010-05-25T14:21:06Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 14:21, 25 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://www.cppe.ru/index.php?title=C%2B%2B/Qt/QSplitter&amp;diff=1143&amp;oldid=prev</id>
		<title>Admin: 1 версия:&amp;#32;Импорт контента...</title>
		<link rel="alternate" type="text/html" href="http://www.cppe.ru/index.php?title=C%2B%2B/Qt/QSplitter&amp;diff=1143&amp;oldid=prev"/>
				<updated>2010-05-25T10:24:56Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия: Импорт контента...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Paint QSplitter==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;  &lt;br /&gt;
/****************************************************************************&lt;br /&gt;
**&lt;br /&gt;
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).&lt;br /&gt;
** All rights reserved.&lt;br /&gt;
** Contact: Nokia Corporation (qt-info@nokia.com)&lt;br /&gt;
**&lt;br /&gt;
** This file is part of the documentation of the Qt Toolkit.&lt;br /&gt;
**&lt;br /&gt;
** $QT_BEGIN_LICENSE:LGPL$&lt;br /&gt;
** Commercial Usage&lt;br /&gt;
** Licensees holding valid Qt Commercial licenses may use this file in&lt;br /&gt;
** accordance with the Qt Commercial License Agreement provided with the&lt;br /&gt;
** Software or, alternatively, in accordance with the terms contained in&lt;br /&gt;
** a written agreement between you and Nokia.&lt;br /&gt;
**&lt;br /&gt;
** GNU Lesser General Public License Usage&lt;br /&gt;
** Alternatively, this file may be used under the terms of the GNU Lesser&lt;br /&gt;
** General Public License version 2.1 as published by the Free Software&lt;br /&gt;
** Foundation and appearing in the file LICENSE.LGPL included in the&lt;br /&gt;
** packaging of this file.  Please review the following information to&lt;br /&gt;
** ensure the GNU Lesser General Public License version 2.1 requirements&lt;br /&gt;
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.&lt;br /&gt;
**&lt;br /&gt;
** In addition, as a special exception, Nokia gives you certain additional&lt;br /&gt;
** rights.  These rights are described in the Nokia Qt LGPL Exception&lt;br /&gt;
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.&lt;br /&gt;
**&lt;br /&gt;
** GNU General Public License Usage&lt;br /&gt;
** Alternatively, this file may be used under the terms of the GNU&lt;br /&gt;
** General Public License version 3.0 as published by the Free Software&lt;br /&gt;
** Foundation and appearing in the file LICENSE.GPL included in the&lt;br /&gt;
** packaging of this file.  Please review the following information to&lt;br /&gt;
** ensure the GNU General Public License version 3.0 requirements will be&lt;br /&gt;
** met: http://www.gnu.org/copyleft/gpl.html.&lt;br /&gt;
**&lt;br /&gt;
** If you have questions regarding the use of this file, please contact&lt;br /&gt;
** Nokia at qt-info@nokia.com.&lt;br /&gt;
** $QT_END_LICENSE$&lt;br /&gt;
**&lt;br /&gt;
****************************************************************************/&lt;br /&gt;
#ifndef SPLITTER_H&lt;br /&gt;
#define SPLITTER_H&lt;br /&gt;
#include &amp;lt;QLinearGradient&amp;gt;&lt;br /&gt;
#include &amp;lt;QSplitter&amp;gt;&lt;br /&gt;
#include &amp;lt;QSplitterHandle&amp;gt;&lt;br /&gt;
class QPaintEvent;&lt;br /&gt;
&lt;br /&gt;
class Splitter : public QSplitter&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
    Splitter(Qt::Orientation orientation, QWidget *parent = 0);&lt;br /&gt;
protected:&lt;br /&gt;
    QSplitterHandle *createHandle();&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
class SplitterHandle : public QSplitterHandle&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
    SplitterHandle(Qt::Orientation orientation, QSplitter *parent);&lt;br /&gt;
protected:&lt;br /&gt;
    void paintEvent(QPaintEvent *event);&lt;br /&gt;
private:&lt;br /&gt;
    QLinearGradient gradient;&lt;br /&gt;
};&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;QtGui&amp;gt;&lt;br /&gt;
#include &amp;quot;splitter.h&amp;quot;&lt;br /&gt;
SplitterHandle::SplitterHandle(Qt::Orientation orientation, QSplitter *parent)&lt;br /&gt;
    : QSplitterHandle(orientation, parent)&lt;br /&gt;
{&lt;br /&gt;
    gradient.setColorAt(0.0, Qt::darkGreen);&lt;br /&gt;
    gradient.setColorAt(0.25, Qt::white);&lt;br /&gt;
    gradient.setColorAt(1.0, Qt::darkGreen);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void SplitterHandle::paintEvent(QPaintEvent *event)&lt;br /&gt;
{&lt;br /&gt;
    QPainter painter(this);&lt;br /&gt;
    if (orientation() == Qt::Horizontal) {&lt;br /&gt;
        gradient.setStart(rect().left(), rect().height()/2);&lt;br /&gt;
        gradient.setFinalStop(rect().right(), rect().height()/2);&lt;br /&gt;
    } else {&lt;br /&gt;
        gradient.setStart(rect().width()/2, rect().top());&lt;br /&gt;
        gradient.setFinalStop(rect().width()/2, rect().bottom());&lt;br /&gt;
    }&lt;br /&gt;
    painter.fillRect(event-&amp;gt;rect(), QBrush(gradient));&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Splitter::Splitter(Qt::Orientation orientation, QWidget *parent)&lt;br /&gt;
    : QSplitter(orientation, parent)&lt;br /&gt;
{&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
QSplitterHandle *Splitter::createHandle()&lt;br /&gt;
{&lt;br /&gt;
    return new SplitterHandle(orientation(), this);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;QApplication&amp;gt;&lt;br /&gt;
#include &amp;lt;QLabel&amp;gt;&lt;br /&gt;
#include &amp;quot;splitter.h&amp;quot;&lt;br /&gt;
int main(int argc, char *argv[])&lt;br /&gt;
{&lt;br /&gt;
    QApplication app(argc, argv);&lt;br /&gt;
    Splitter splitter(Qt::Horizontal);&lt;br /&gt;
    splitter.addWidget(new QLabel(&amp;quot;Hello&amp;quot;));&lt;br /&gt;
    splitter.addWidget(new QLabel(&amp;quot;World&amp;quot;));&lt;br /&gt;
    Splitter verticalSplitter(Qt::Vertical, &amp;amp;splitter);&lt;br /&gt;
    verticalSplitter.addWidget(new QLabel(&amp;quot;A&amp;quot;));&lt;br /&gt;
    verticalSplitter.addWidget(new QLabel(&amp;quot;B&amp;quot;));&lt;br /&gt;
    splitter.show();&lt;br /&gt;
    return app.exec();&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==QSplitter, QListView and QTreeView==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;  &lt;br /&gt;
/****************************************************************************&lt;br /&gt;
**&lt;br /&gt;
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).&lt;br /&gt;
** All rights reserved.&lt;br /&gt;
** Contact: Nokia Corporation (qt-info@nokia.com)&lt;br /&gt;
**&lt;br /&gt;
** This file is part of the documentation of the Qt Toolkit.&lt;br /&gt;
**&lt;br /&gt;
** $QT_BEGIN_LICENSE:LGPL$&lt;br /&gt;
** Commercial Usage&lt;br /&gt;
** Licensees holding valid Qt Commercial licenses may use this file in&lt;br /&gt;
** accordance with the Qt Commercial License Agreement provided with the&lt;br /&gt;
** Software or, alternatively, in accordance with the terms contained in&lt;br /&gt;
** a written agreement between you and Nokia.&lt;br /&gt;
**&lt;br /&gt;
** GNU Lesser General Public License Usage&lt;br /&gt;
** Alternatively, this file may be used under the terms of the GNU Lesser&lt;br /&gt;
** General Public License version 2.1 as published by the Free Software&lt;br /&gt;
** Foundation and appearing in the file LICENSE.LGPL included in the&lt;br /&gt;
** packaging of this file.  Please review the following information to&lt;br /&gt;
** ensure the GNU Lesser General Public License version 2.1 requirements&lt;br /&gt;
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.&lt;br /&gt;
**&lt;br /&gt;
** In addition, as a special exception, Nokia gives you certain additional&lt;br /&gt;
** rights.  These rights are described in the Nokia Qt LGPL Exception&lt;br /&gt;
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.&lt;br /&gt;
**&lt;br /&gt;
** GNU General Public License Usage&lt;br /&gt;
** Alternatively, this file may be used under the terms of the GNU&lt;br /&gt;
** General Public License version 3.0 as published by the Free Software&lt;br /&gt;
** Foundation and appearing in the file LICENSE.GPL included in the&lt;br /&gt;
** packaging of this file.  Please review the following information to&lt;br /&gt;
** ensure the GNU General Public License version 3.0 requirements will be&lt;br /&gt;
** met: http://www.gnu.org/copyleft/gpl.html.&lt;br /&gt;
**&lt;br /&gt;
** If you have questions regarding the use of this file, please contact&lt;br /&gt;
** Nokia at qt-info@nokia.com.&lt;br /&gt;
** $QT_END_LICENSE$&lt;br /&gt;
**&lt;br /&gt;
****************************************************************************/&lt;br /&gt;
#include &amp;lt;QtGui&amp;gt;&lt;br /&gt;
void processSize(int)&lt;br /&gt;
{&lt;br /&gt;
}&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
    QWidget *parent = 0;&lt;br /&gt;
&lt;br /&gt;
    QSplitter *splitter = new QSplitter(parent);&lt;br /&gt;
    QListView *listview = new QListView;&lt;br /&gt;
    QTreeView *treeview = new QTreeView;&lt;br /&gt;
    QTextEdit *textedit = new QTextEdit;&lt;br /&gt;
    splitter-&amp;gt;addWidget(listview);&lt;br /&gt;
    splitter-&amp;gt;addWidget(treeview);&lt;br /&gt;
    splitter-&amp;gt;addWidget(textedit);&lt;br /&gt;
&lt;br /&gt;
    {&lt;br /&gt;
    // SAVE STATE&lt;br /&gt;
    QSettings settings;&lt;br /&gt;
    settings.setValue(&amp;quot;splitterSizes&amp;quot;, splitter-&amp;gt;saveState());&lt;br /&gt;
    }&lt;br /&gt;
    {&lt;br /&gt;
    // RESTORE STATE&lt;br /&gt;
    QSettings settings;&lt;br /&gt;
    splitter-&amp;gt;restoreState(settings.value(&amp;quot;splitterSizes&amp;quot;).toByteArray());&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    QListIterator&amp;lt;int&amp;gt; it(splitter-&amp;gt;sizes());&lt;br /&gt;
    while (it.hasNext())&lt;br /&gt;
        processSize(it.next());&lt;br /&gt;
&lt;br /&gt;
    return 0;&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Set Stretch Factor for QSplitter==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;  &lt;br /&gt;
#include &amp;lt;QtGui&amp;gt;&lt;br /&gt;
int main(int argc, char *argv[]){&lt;br /&gt;
  QApplication a(argc, argv);&lt;br /&gt;
  QSplitter s;&lt;br /&gt;
  QTextEdit *txtEdit = 0;&lt;br /&gt;
  for (int stretch = 1; stretch &amp;lt;= 5; stretch++) {&lt;br /&gt;
    txtEdit = new QTextEdit(&amp;amp;s);&lt;br /&gt;
    s.addWidget(txtEdit);&lt;br /&gt;
    s.setStretchFactor(s.indexOf(txtEdit), stretch);&lt;br /&gt;
  }&lt;br /&gt;
  s.show();&lt;br /&gt;
  return a.exec();&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>