forked from qt-creator/qt-creator
Merge commit 'origin/1.2'
This commit is contained in:
11
dist/changes-1.2.0
vendored
11
dist/changes-1.2.0
vendored
@@ -22,8 +22,15 @@ Editing
|
|||||||
* Further improvements to FakeVim mode
|
* Further improvements to FakeVim mode
|
||||||
* Make it possible to disable Ctrl+Click navigation
|
* Make it possible to disable Ctrl+Click navigation
|
||||||
* Added optional XCode-style tab indentation
|
* Added optional XCode-style tab indentation
|
||||||
|
* Ui changes are added immediately to the code model
|
||||||
|
* Fixed possibly missing code completion with mingw toolchain
|
||||||
|
* Added option for turning antialiasing of text editor fonts off
|
||||||
|
* Added searching with regular expressions in text editors
|
||||||
|
|
||||||
Building and Running
|
Building and Running
|
||||||
|
* New options: Auto-Save before Build and Run without building
|
||||||
|
* Environment settings
|
||||||
|
* Fixed bug that prevented use of Qt 4 with version < 4.2
|
||||||
|
|
||||||
Debugging
|
Debugging
|
||||||
* Added Windows Console Debugger support (x86 and AMD64)
|
* Added Windows Console Debugger support (x86 and AMD64)
|
||||||
@@ -32,6 +39,7 @@ Debugging
|
|||||||
avoid crashes for speedup
|
avoid crashes for speedup
|
||||||
* Changed method of dumper loading on Windows, enabling it for MinGW 64
|
* Changed method of dumper loading on Windows, enabling it for MinGW 64
|
||||||
* Make it possible to disable breakpoints
|
* Make it possible to disable breakpoints
|
||||||
|
* Make it possible to float the debugger views
|
||||||
|
|
||||||
Wizards
|
Wizards
|
||||||
|
|
||||||
@@ -66,7 +74,8 @@ Other Unixes
|
|||||||
|
|
||||||
Additional credits go to:
|
Additional credits go to:
|
||||||
* axasia <axasia@gmail.com> (japanese translation)
|
* axasia <axasia@gmail.com> (japanese translation)
|
||||||
* Christian Hoenig <christian@hoenig.cc> ("Build Project Only" submenu and build project dependencies, various patches)
|
* Christian Hoenig <christian@hoenig.cc> ("Build Project Only" submenu and
|
||||||
|
build project dependencies, various patches)
|
||||||
* Enrico Ros <enrico.ros@gmail.com> (italian translation)
|
* Enrico Ros <enrico.ros@gmail.com> (italian translation)
|
||||||
* Joel Nordell <joel.nordell@chloridepower.com> (XCode-style tab behavior, various patches)
|
* Joel Nordell <joel.nordell@chloridepower.com> (XCode-style tab behavior, various patches)
|
||||||
* Serge Ratke <dev.serge.ratke@gmx.de> (copy lines up/down by Ctrl+Alt+Up/Down)
|
* Serge Ratke <dev.serge.ratke@gmx.de> (copy lines up/down by Ctrl+Alt+Up/Down)
|
||||||
|
|||||||
@@ -165,6 +165,10 @@ struct EditorManagerPrivate {
|
|||||||
|
|
||||||
QList<IEditor *> m_editorHistory;
|
QList<IEditor *> m_editorHistory;
|
||||||
QList<EditLocation *> m_navigationHistory;
|
QList<EditLocation *> m_navigationHistory;
|
||||||
|
void clearNavigationHistory() {
|
||||||
|
qDeleteAll(m_navigationHistory);
|
||||||
|
m_navigationHistory.clear();
|
||||||
|
}
|
||||||
int currentNavigationHistoryPosition;
|
int currentNavigationHistoryPosition;
|
||||||
Internal::OpenEditorsWindow *m_windowPopup;
|
Internal::OpenEditorsWindow *m_windowPopup;
|
||||||
Core::BaseView *m_openEditorsView;
|
Core::BaseView *m_openEditorsView;
|
||||||
@@ -205,8 +209,7 @@ EditorManagerPrivate::EditorManagerPrivate(ICore *core, QWidget *parent) :
|
|||||||
|
|
||||||
EditorManagerPrivate::~EditorManagerPrivate()
|
EditorManagerPrivate::~EditorManagerPrivate()
|
||||||
{
|
{
|
||||||
qDeleteAll(m_navigationHistory);
|
clearNavigationHistory();
|
||||||
m_navigationHistory.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EditorManager *EditorManager::m_instance = 0;
|
EditorManager *EditorManager::m_instance = 0;
|
||||||
@@ -654,7 +657,11 @@ QList<IFile *> EditorManager::filesForEditors(QList<IEditor *> editors) const
|
|||||||
bool EditorManager::closeAllEditors(bool askAboutModifiedEditors)
|
bool EditorManager::closeAllEditors(bool askAboutModifiedEditors)
|
||||||
{
|
{
|
||||||
m_d->m_editorModel->removeAllRestoredEditors();
|
m_d->m_editorModel->removeAllRestoredEditors();
|
||||||
return closeEditors(openedEditors(), askAboutModifiedEditors);
|
if (closeEditors(openedEditors(), askAboutModifiedEditors)) {
|
||||||
|
m_d->clearNavigationHistory();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorManager::closeOtherEditors()
|
void EditorManager::closeOtherEditors()
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ void ProgressBar::paintEvent(QPaintEvent *)
|
|||||||
p.setPen(QColor(255, 255, 255, 70));
|
p.setPen(QColor(255, 255, 255, 70));
|
||||||
p.drawLine(0, 1, size().width(), 1);
|
p.drawLine(0, 1, size().width(), 1);
|
||||||
|
|
||||||
QRect textRect = rect();
|
QRect textRect = rect().adjusted(0, 0, -1, 0);
|
||||||
textRect.setHeight(h+5);
|
textRect.setHeight(h+5);
|
||||||
|
|
||||||
p.setPen(QColor(30, 30, 30, 80));
|
p.setPen(QColor(30, 30, 30, 80));
|
||||||
@@ -149,9 +149,8 @@ void ProgressBar::paintEvent(QPaintEvent *)
|
|||||||
QRect inner = rect.adjusted(2, 2, -1, -1);
|
QRect inner = rect.adjusted(2, 2, -1, -1);
|
||||||
inner.adjust(0, 0, qRound((percent - 1) * inner.width()), 0);
|
inner.adjust(0, 0, qRound((percent - 1) * inner.width()), 0);
|
||||||
if (m_error) {
|
if (m_error) {
|
||||||
// TODO this is not fancy enough
|
QColor red(255, 60, 0, 210);
|
||||||
QColor red(255, 0, 0, 180);
|
c = red;
|
||||||
p.setBrush(red);
|
|
||||||
// avoid too small red bar
|
// avoid too small red bar
|
||||||
if (inner.width() < 10)
|
if (inner.width() < 10)
|
||||||
inner.adjust(0, 0, 10 - inner.width(), 0);
|
inner.adjust(0, 0, 10 - inner.width(), 0);
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
|
|
||||||
#include <QtCore/QMap>
|
#include <QtCore/QMap>
|
||||||
#include <QtSql/QSqlDatabase>
|
#include <QtSql/QSqlDatabase>
|
||||||
|
#include <QtSql/QSqlError>
|
||||||
#include <QtSql/QSqlQuery>
|
#include <QtSql/QSqlQuery>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
@@ -101,21 +102,24 @@ SettingsDatabase::SettingsDatabase(const QString &path,
|
|||||||
|
|
||||||
d->m_db = QSqlDatabase::addDatabase("QSQLITE", QLatin1String("settings"));
|
d->m_db = QSqlDatabase::addDatabase("QSQLITE", QLatin1String("settings"));
|
||||||
d->m_db.setDatabaseName(fileName);
|
d->m_db.setDatabaseName(fileName);
|
||||||
if (!d->m_db.open())
|
if (!d->m_db.open()) {
|
||||||
qWarning() << "Warning: Failed to open settings database!";
|
qWarning().nospace() << "Warning: Failed to open settings database at " << fileName << " ("
|
||||||
|
<< d->m_db.lastError().driverText() << ")";
|
||||||
|
} else {
|
||||||
|
// Create the settings table if it doesn't exist yet
|
||||||
|
QSqlQuery query(d->m_db);
|
||||||
|
query.prepare(QLatin1String("CREATE TABLE IF NOT EXISTS settings ("
|
||||||
|
"key PRIMARY KEY ON CONFLICT REPLACE, "
|
||||||
|
"value)"));
|
||||||
|
if (!query.exec())
|
||||||
|
qWarning().nospace() << "Warning: Failed to prepare settings database! ("
|
||||||
|
<< query.lastError().driverText() << ")";
|
||||||
|
|
||||||
// Create the settings table if it doesn't exist yet
|
// Retrieve all available keys (values are retrieved lazily)
|
||||||
QSqlQuery query(d->m_db);
|
if (query.exec(QLatin1String("SELECT key FROM settings"))) {
|
||||||
query.prepare(QLatin1String("CREATE TABLE IF NOT EXISTS settings ("
|
while (query.next()) {
|
||||||
"key PRIMARY KEY ON CONFLICT REPLACE, "
|
d->m_settings.insert(query.value(0).toString(), QVariant());
|
||||||
"value)"));
|
}
|
||||||
if (d->m_db.isOpen() && !query.exec())
|
|
||||||
qWarning() << "Warning: Failed to prepare settings database!";
|
|
||||||
|
|
||||||
// Retrieve all available keys (values are retrieved lazily)
|
|
||||||
if (query.exec(QLatin1String("SELECT key FROM settings"))) {
|
|
||||||
while (query.next()) {
|
|
||||||
d->m_settings.insert(query.value(0).toString(), QVariant());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -135,6 +139,9 @@ void SettingsDatabase::setValue(const QString &key, const QVariant &value)
|
|||||||
// Add to cache
|
// Add to cache
|
||||||
d->m_settings.insert(effectiveKey, value);
|
d->m_settings.insert(effectiveKey, value);
|
||||||
|
|
||||||
|
if (!d->m_db.isOpen())
|
||||||
|
return;
|
||||||
|
|
||||||
// Instant apply (TODO: Delay writing out settings)
|
// Instant apply (TODO: Delay writing out settings)
|
||||||
QSqlQuery query(d->m_db);
|
QSqlQuery query(d->m_db);
|
||||||
query.prepare(QLatin1String("INSERT INTO settings VALUES (?, ?)"));
|
query.prepare(QLatin1String("INSERT INTO settings VALUES (?, ?)"));
|
||||||
@@ -154,7 +161,7 @@ QVariant SettingsDatabase::value(const QString &key, const QVariant &defaultValu
|
|||||||
SettingsMap::const_iterator i = d->m_settings.constFind(effectiveKey);
|
SettingsMap::const_iterator i = d->m_settings.constFind(effectiveKey);
|
||||||
if (i != d->m_settings.constEnd() && i.value().isValid()) {
|
if (i != d->m_settings.constEnd() && i.value().isValid()) {
|
||||||
value = i.value();
|
value = i.value();
|
||||||
} else {
|
} else if (d->m_db.isOpen()) {
|
||||||
// Try to read the value from the database
|
// Try to read the value from the database
|
||||||
QSqlQuery query(d->m_db);
|
QSqlQuery query(d->m_db);
|
||||||
query.prepare(QLatin1String("SELECT value FROM settings WHERE key = ?"));
|
query.prepare(QLatin1String("SELECT value FROM settings WHERE key = ?"));
|
||||||
@@ -183,13 +190,6 @@ void SettingsDatabase::remove(const QString &key)
|
|||||||
{
|
{
|
||||||
const QString effectiveKey = d->effectiveKey(key);
|
const QString effectiveKey = d->effectiveKey(key);
|
||||||
|
|
||||||
// Delete keys from the database
|
|
||||||
QSqlQuery query(d->m_db);
|
|
||||||
query.prepare(QLatin1String("DELETE FROM settings WHERE key = ? OR key LIKE ?"));
|
|
||||||
query.addBindValue(effectiveKey);
|
|
||||||
query.addBindValue(effectiveKey + QLatin1String("/%"));
|
|
||||||
query.exec();
|
|
||||||
|
|
||||||
// Remove keys from the cache
|
// Remove keys from the cache
|
||||||
foreach (const QString &k, d->m_settings.keys()) {
|
foreach (const QString &k, d->m_settings.keys()) {
|
||||||
// Either it's an exact match, or it matches up to a /
|
// Either it's an exact match, or it matches up to a /
|
||||||
@@ -200,6 +200,16 @@ void SettingsDatabase::remove(const QString &key)
|
|||||||
d->m_settings.remove(k);
|
d->m_settings.remove(k);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!d->m_db.isOpen())
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Delete keys from the database
|
||||||
|
QSqlQuery query(d->m_db);
|
||||||
|
query.prepare(QLatin1String("DELETE FROM settings WHERE key = ? OR key LIKE ?"));
|
||||||
|
query.addBindValue(effectiveKey);
|
||||||
|
query.addBindValue(effectiveKey + QLatin1String("/%"));
|
||||||
|
query.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsDatabase::beginGroup(const QString &prefix)
|
void SettingsDatabase::beginGroup(const QString &prefix)
|
||||||
|
|||||||
@@ -48,6 +48,16 @@ static int range(float x, int min, int max)
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
QColor StyleHelper::mergedColors(const QColor &colorA, const QColor &colorB, int factor)
|
||||||
|
{
|
||||||
|
const int maxFactor = 100;
|
||||||
|
QColor tmp = colorA;
|
||||||
|
tmp.setRed((tmp.red() * factor) / maxFactor + (colorB.red() * (maxFactor - factor)) / maxFactor);
|
||||||
|
tmp.setGreen((tmp.green() * factor) / maxFactor + (colorB.green() * (maxFactor - factor)) / maxFactor);
|
||||||
|
tmp.setBlue((tmp.blue() * factor) / maxFactor + (colorB.blue() * (maxFactor - factor)) / maxFactor);
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
|
||||||
qreal StyleHelper::sidebarFontSize()
|
qreal StyleHelper::sidebarFontSize()
|
||||||
{
|
{
|
||||||
#if defined(Q_WS_MAC)
|
#if defined(Q_WS_MAC)
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ public:
|
|||||||
static QColor shadowColor();
|
static QColor shadowColor();
|
||||||
static QColor borderColor();
|
static QColor borderColor();
|
||||||
static QColor buttonTextColor() { return QColor(0x4c4c4c); }
|
static QColor buttonTextColor() { return QColor(0x4c4c4c); }
|
||||||
|
static QColor mergedColors(const QColor &colorA, const QColor &colorB, int factor = 50);
|
||||||
|
|
||||||
// Sets the base color and makes sure all top level widgets are updated
|
// Sets the base color and makes sure all top level widgets are updated
|
||||||
static void setBaseColor(const QColor &color);
|
static void setBaseColor(const QColor &color);
|
||||||
|
|||||||
@@ -104,9 +104,14 @@ QList<QuickOpen::FilterEntry> CppQuickOpenFilter::matchesFor(const QString &orig
|
|||||||
foreach (ModelItemInfo info, items) {
|
foreach (ModelItemInfo info, items) {
|
||||||
if ((hasWildcard && regexp.exactMatch(info.symbolName))
|
if ((hasWildcard && regexp.exactMatch(info.symbolName))
|
||||||
|| (!hasWildcard && matcher.indexIn(info.symbolName) != -1)) {
|
|| (!hasWildcard && matcher.indexIn(info.symbolName) != -1)) {
|
||||||
|
|
||||||
QVariant id = qVariantFromValue(info);
|
QVariant id = qVariantFromValue(info);
|
||||||
QuickOpen::FilterEntry filterEntry(this, info.symbolName, id, info.icon);
|
QuickOpen::FilterEntry filterEntry(this, info.symbolName, id, info.icon);
|
||||||
filterEntry.extraInfo = info.symbolType;
|
if (! info.symbolType.isEmpty())
|
||||||
|
filterEntry.extraInfo = info.symbolType;
|
||||||
|
else
|
||||||
|
filterEntry.extraInfo = info.fileName;
|
||||||
|
|
||||||
if (info.symbolName.startsWith(entry))
|
if (info.symbolName.startsWith(entry))
|
||||||
betterEntries.append(filterEntry);
|
betterEntries.append(filterEntry);
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -638,6 +638,7 @@ void FakeVimHandler::Private::finishMovement(const QString &dotCommand)
|
|||||||
int endLine = lineForPosition(position());
|
int endLine = lineForPosition(position());
|
||||||
setPosition(qMin(anchor(), position()));
|
setPosition(qMin(anchor(), position()));
|
||||||
enterExMode();
|
enterExMode();
|
||||||
|
m_currentMessage.clear();
|
||||||
m_commandBuffer = QString(".,+%1!").arg(qAbs(endLine - beginLine));
|
m_commandBuffer = QString(".,+%1!").arg(qAbs(endLine - beginLine));
|
||||||
m_commandHistory.append(QString());
|
m_commandHistory.append(QString());
|
||||||
m_commandHistoryIndex = m_commandHistory.size() - 1;
|
m_commandHistoryIndex = m_commandHistory.size() - 1;
|
||||||
@@ -766,7 +767,6 @@ void FakeVimHandler::Private::updateMiniBuffer()
|
|||||||
msg = "-- PASSING -- ";
|
msg = "-- PASSING -- ";
|
||||||
} else if (!m_currentMessage.isEmpty()) {
|
} else if (!m_currentMessage.isEmpty()) {
|
||||||
msg = m_currentMessage;
|
msg = m_currentMessage;
|
||||||
m_currentMessage.clear();
|
|
||||||
} else if (m_mode == CommandMode && m_visualMode != NoVisualMode) {
|
} else if (m_mode == CommandMode && m_visualMode != NoVisualMode) {
|
||||||
if (m_visualMode == VisualCharMode) {
|
if (m_visualMode == VisualCharMode) {
|
||||||
msg = "-- VISUAL --";
|
msg = "-- VISUAL --";
|
||||||
@@ -991,6 +991,7 @@ EventResult FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
|
|||||||
finishMovement();
|
finishMovement();
|
||||||
} else if (key == ':') {
|
} else if (key == ':') {
|
||||||
enterExMode();
|
enterExMode();
|
||||||
|
m_currentMessage.clear();
|
||||||
m_commandBuffer.clear();
|
m_commandBuffer.clear();
|
||||||
if (m_visualMode != NoVisualMode)
|
if (m_visualMode != NoVisualMode)
|
||||||
m_commandBuffer = "'<,'>";
|
m_commandBuffer = "'<,'>";
|
||||||
@@ -1005,6 +1006,7 @@ EventResult FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
|
|||||||
// FIXME: make core find dialog sufficiently flexible to
|
// FIXME: make core find dialog sufficiently flexible to
|
||||||
// produce the "default vi" behaviour too. For now, roll our own.
|
// produce the "default vi" behaviour too. For now, roll our own.
|
||||||
enterExMode(); // to get the cursor disabled
|
enterExMode(); // to get the cursor disabled
|
||||||
|
m_currentMessage.clear();
|
||||||
m_mode = (key == '/') ? SearchForwardMode : SearchBackwardMode;
|
m_mode = (key == '/') ? SearchForwardMode : SearchBackwardMode;
|
||||||
m_commandBuffer.clear();
|
m_commandBuffer.clear();
|
||||||
m_searchHistory.append(QString());
|
m_searchHistory.append(QString());
|
||||||
@@ -1033,6 +1035,7 @@ EventResult FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
|
|||||||
m_submode = FilterSubMode;
|
m_submode = FilterSubMode;
|
||||||
} else if (key == '!' && m_visualMode != NoVisualMode) {
|
} else if (key == '!' && m_visualMode != NoVisualMode) {
|
||||||
enterExMode();
|
enterExMode();
|
||||||
|
m_currentMessage.clear();
|
||||||
m_commandBuffer = "'<,'>!";
|
m_commandBuffer = "'<,'>!";
|
||||||
m_commandHistory.append(QString());
|
m_commandHistory.append(QString());
|
||||||
m_commandHistoryIndex = m_commandHistory.size() - 1;
|
m_commandHistoryIndex = m_commandHistory.size() - 1;
|
||||||
@@ -1971,6 +1974,7 @@ void FakeVimHandler::Private::handleExCommand(const QString &cmd0)
|
|||||||
enterCommandMode();
|
enterCommandMode();
|
||||||
updateMiniBuffer();
|
updateMiniBuffer();
|
||||||
} else {
|
} else {
|
||||||
|
enterCommandMode();
|
||||||
showRedMessage(tr("E492: Not an editor command: ") + cmd0);
|
showRedMessage(tr("E492: Not an editor command: ") + cmd0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -854,6 +854,13 @@ void ProjectExplorerPlugin::showSessionManager()
|
|||||||
sessionDialog.exec();
|
sessionDialog.exec();
|
||||||
|
|
||||||
updateActions();
|
updateActions();
|
||||||
|
|
||||||
|
Core::ModeManager *modeManager = Core::ModeManager::instance();
|
||||||
|
Core::IMode *welcomeMode = modeManager->mode(Core::Constants::MODE_WELCOME);
|
||||||
|
if (modeManager->currentMode() == welcomeMode)
|
||||||
|
{
|
||||||
|
updateWelcomePage(qobject_cast<Core::Internal::WelcomeMode*>(welcomeMode));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectExplorerPlugin::setStartupProject(Project *project)
|
void ProjectExplorerPlugin::setStartupProject(Project *project)
|
||||||
|
|||||||
@@ -139,15 +139,13 @@ void SessionDialog::updateActions()
|
|||||||
|
|
||||||
if (m_ui.sessionList->currentItem())
|
if (m_ui.sessionList->currentItem())
|
||||||
enableDelete = (m_ui.sessionList->currentItem()->text() != m_sessionManager->activeSession()
|
enableDelete = (m_ui.sessionList->currentItem()->text() != m_sessionManager->activeSession()
|
||||||
&& m_ui.sessionList->currentItem()->text() != "default");
|
&& (m_ui.sessionList->currentItem()->text() != QLatin1String("default")));
|
||||||
m_ui.btDelete->setEnabled(enableDelete);
|
m_ui.btDelete->setEnabled(enableDelete);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SessionDialog::accept()
|
void SessionDialog::accept()
|
||||||
{
|
{
|
||||||
if (m_ui.sessionList->currentItem()) {
|
// do nothing
|
||||||
m_sessionManager->loadSession(m_ui.sessionList->currentItem()->text());
|
|
||||||
}
|
|
||||||
QDialog::accept();
|
QDialog::accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,17 +14,10 @@
|
|||||||
<string>Session Manager</string>
|
<string>Session Manager</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="0" column="0">
|
<item row="0" column="0" colspan="2">
|
||||||
<widget class="QLabel" name="label">
|
|
||||||
<property name="text">
|
|
||||||
<string>Choose your session</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0" colspan="2">
|
|
||||||
<widget class="QListWidget" name="sessionList"/>
|
<widget class="QListWidget" name="sessionList"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="2">
|
<item row="0" column="2">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="btCreateNew">
|
<widget class="QPushButton" name="btCreateNew">
|
||||||
@@ -62,14 +55,14 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QLabel" name="whatsASessionLabel">
|
<widget class="QLabel" name="whatsASessionLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string><a href="qthelp://com.nokia.qtcreator/doc/creator-quick-tour.html#session-management-in-qt-creator">What is a Session?</a></string>
|
<string><a href="qthelp://com.nokia.qtcreator/doc/creator-quick-tour.html#session-management-in-qt-creator">What is a Session?</a></string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1" colspan="2">
|
<item row="1" column="1" colspan="2">
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
<property name="standardButtons">
|
<property name="standardButtons">
|
||||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
|
|||||||
@@ -385,8 +385,7 @@ QtVersion::QtVersion(const QString &name, const QString &path)
|
|||||||
|
|
||||||
QtVersion::~QtVersion()
|
QtVersion::~QtVersion()
|
||||||
{
|
{
|
||||||
delete m_toolChain;
|
|
||||||
m_toolChain = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QtVersion::name() const
|
QString QtVersion::name() const
|
||||||
@@ -853,7 +852,7 @@ void QtVersion::updateQMakeCXX() const
|
|||||||
ProjectExplorer::ToolChain *QtVersion::toolChain() const
|
ProjectExplorer::ToolChain *QtVersion::toolChain() const
|
||||||
{
|
{
|
||||||
updateToolChain();
|
updateToolChain();
|
||||||
return m_toolChain;
|
return m_toolChain.data();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QtVersion::updateToolChain() const
|
void QtVersion::updateToolChain() const
|
||||||
@@ -893,11 +892,10 @@ void QtVersion::updateToolChain() const
|
|||||||
qDebug()<<"Qt Creator doesn't know about the system includes, nor the systems defines.";
|
qDebug()<<"Qt Creator doesn't know about the system includes, nor the systems defines.";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ProjectExplorer::ToolChain::equals(m_test, m_toolChain)) {
|
if (ProjectExplorer::ToolChain::equals(m_test, m_toolChain.data())) {
|
||||||
delete m_test;
|
delete m_test;
|
||||||
} else {
|
} else {
|
||||||
delete m_toolChain;
|
m_toolChain = QSharedPointer<ProjectExplorer::ToolChain>(m_test);
|
||||||
m_toolChain = m_test;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_toolChainUpToDate = true;
|
m_toolChainUpToDate = true;
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
#include <projectexplorer/environment.h>
|
#include <projectexplorer/environment.h>
|
||||||
#include <projectexplorer/toolchain.h>
|
#include <projectexplorer/toolchain.h>
|
||||||
|
|
||||||
|
#include <QtCore/QSharedPointer>
|
||||||
#include <QtCore/QHash>
|
#include <QtCore/QHash>
|
||||||
|
|
||||||
namespace Qt4ProjectManager {
|
namespace Qt4ProjectManager {
|
||||||
@@ -154,7 +155,7 @@ private:
|
|||||||
mutable QString m_qmakeCXX;
|
mutable QString m_qmakeCXX;
|
||||||
|
|
||||||
mutable bool m_toolChainUpToDate;
|
mutable bool m_toolChainUpToDate;
|
||||||
mutable ProjectExplorer::ToolChain *m_toolChain;
|
mutable QSharedPointer<ProjectExplorer::ToolChain> m_toolChain;
|
||||||
};
|
};
|
||||||
|
|
||||||
class QtVersionManager : public QObject
|
class QtVersionManager : public QObject
|
||||||
|
|||||||
@@ -42,6 +42,7 @@
|
|||||||
#include <coreplugin/coreconstants.h>
|
#include <coreplugin/coreconstants.h>
|
||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
#include <coreplugin/manhattanstyle.h>
|
#include <coreplugin/manhattanstyle.h>
|
||||||
|
#include <coreplugin/stylehelper.h>
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
#include <find/basetextfind.h>
|
#include <find/basetextfind.h>
|
||||||
#include <texteditor/fontsettings.h>
|
#include <texteditor/fontsettings.h>
|
||||||
@@ -233,6 +234,12 @@ void BaseTextEditor::print(QPrinter *printer)
|
|||||||
delete dlg;
|
delete dlg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int collapseBoxWidth(const QFontMetrics &fm)
|
||||||
|
{
|
||||||
|
const int lineSpacing = fm.lineSpacing();
|
||||||
|
return lineSpacing + lineSpacing%2 + 1;
|
||||||
|
}
|
||||||
|
|
||||||
static void printPage(int index, QPainter *painter, const QTextDocument *doc,
|
static void printPage(int index, QPainter *painter, const QTextDocument *doc,
|
||||||
const QRectF &body, const QRectF &titleBox,
|
const QRectF &body, const QRectF &titleBox,
|
||||||
const QString &title)
|
const QString &title)
|
||||||
@@ -1566,10 +1573,10 @@ QRect BaseTextEditor::collapseBox()
|
|||||||
return QRect();
|
return QRect();
|
||||||
QRectF br = blockBoundingGeometry(begin).translated(contentOffset());
|
QRectF br = blockBoundingGeometry(begin).translated(contentOffset());
|
||||||
QRectF er = blockBoundingGeometry(end).translated(contentOffset());
|
QRectF er = blockBoundingGeometry(end).translated(contentOffset());
|
||||||
int collapseBoxWidth = fontMetrics().lineSpacing() + 1;
|
|
||||||
return QRect(d->m_extraArea->width() - collapseBoxWidth,
|
return QRect(d->m_extraArea->width() - collapseBoxWidth(fontMetrics()),
|
||||||
int(br.top()),
|
int(br.top()),
|
||||||
collapseBoxWidth,
|
collapseBoxWidth(fontMetrics()),
|
||||||
er.bottom() - br.top());
|
er.bottom() - br.top());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2240,7 +2247,7 @@ int BaseTextEditor::extraAreaWidth(int *markWidthPtr) const
|
|||||||
space += 4;
|
space += 4;
|
||||||
|
|
||||||
if (d->m_codeFoldingVisible)
|
if (d->m_codeFoldingVisible)
|
||||||
space += fm.lineSpacing();
|
space += collapseBoxWidth(fm);
|
||||||
return space;
|
return space;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2260,13 +2267,11 @@ static void drawRectBox(QPainter *painter, const QRect &rect, bool start, bool e
|
|||||||
|
|
||||||
QRgb b = pal.base().color().rgb();
|
QRgb b = pal.base().color().rgb();
|
||||||
QRgb h = pal.highlight().color().rgb();
|
QRgb h = pal.highlight().color().rgb();
|
||||||
QColor c = QColor((qRed(b)*2+qRed(h))/3,
|
QColor c = StyleHelper::mergedColors(b,h, 50);
|
||||||
(qGreen(b)*2+qGreen(h))/3,
|
|
||||||
(qBlue(b)*2+qBlue(h))/3);
|
|
||||||
|
|
||||||
QLinearGradient grad(rect.topLeft(), rect.topRight());
|
QLinearGradient grad(rect.topLeft(), rect.topRight());
|
||||||
grad.setColorAt(0, c.lighter(110));
|
grad.setColorAt(0, c.lighter(110));
|
||||||
grad.setColorAt(1, c.lighter(160));
|
grad.setColorAt(1, c.lighter(130));
|
||||||
QColor outline = c;
|
QColor outline = c;
|
||||||
QRect r = rect;
|
QRect r = rect;
|
||||||
|
|
||||||
@@ -2305,8 +2310,7 @@ void BaseTextEditor::extraAreaPaintEvent(QPaintEvent *e)
|
|||||||
// if (documentLayout->doubleMarkCount)
|
// if (documentLayout->doubleMarkCount)
|
||||||
// markWidth += fm.lineSpacing() / 3;
|
// markWidth += fm.lineSpacing() / 3;
|
||||||
|
|
||||||
const int collapseBoxWidth = d->m_codeFoldingVisible ? fmLineSpacing + 1: 0;
|
const int extraAreaWidth = d->m_extraArea->width() - collapseBoxWidth(fm);
|
||||||
const int extraAreaWidth = d->m_extraArea->width() - collapseBoxWidth;
|
|
||||||
|
|
||||||
painter.fillRect(e->rect(), pal.color(QPalette::Base));
|
painter.fillRect(e->rect(), pal.color(QPalette::Base));
|
||||||
painter.fillRect(e->rect().intersected(QRect(0, 0, extraAreaWidth, INT_MAX)),
|
painter.fillRect(e->rect().intersected(QRect(0, 0, extraAreaWidth, INT_MAX)),
|
||||||
@@ -2414,15 +2418,18 @@ void BaseTextEditor::extraAreaPaintEvent(QPaintEvent *e)
|
|||||||
bool hovered = blockNumber >= extraAreaHighlightCollapseBlockNumber
|
bool hovered = blockNumber >= extraAreaHighlightCollapseBlockNumber
|
||||||
&& blockNumber <= extraAreaHighlightCollapseEndBlockNumber;
|
&& blockNumber <= extraAreaHighlightCollapseEndBlockNumber;
|
||||||
|
|
||||||
|
int boxWidth = collapseBoxWidth(fm);
|
||||||
if (hovered) {
|
if (hovered) {
|
||||||
QRect box = QRect(extraAreaWidth + 1, top, collapseBoxWidth - 2, collapseBoxWidth);
|
QRect box = QRect(extraAreaWidth + 1, top, boxWidth - 2, fmLineSpacing + 2);
|
||||||
drawRectBox(&painter, box, drawStart, drawEnd, pal);
|
drawRectBox(&painter, box, drawStart, drawEnd, pal);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (drawBox) {
|
if (drawBox) {
|
||||||
bool expanded = nextBlock.isVisible();
|
bool expanded = nextBlock.isVisible();
|
||||||
QRect box(extraAreaWidth + collapseBoxWidth/4, top + collapseBoxWidth/4,
|
int margin = 2;
|
||||||
2 * (collapseBoxWidth/4) + 1, 2 * (collapseBoxWidth/4) + 1);
|
int size = boxWidth/4;
|
||||||
|
QRect box(extraAreaWidth + size, top + size,
|
||||||
|
2 * (size) + 1, 2 * (size) + 1);
|
||||||
drawFoldingMarker(&painter, pal, box, expanded, active, hovered);
|
drawFoldingMarker(&painter, pal, box, expanded, active, hovered);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2473,32 +2480,38 @@ void BaseTextEditor::drawFoldingMarker(QPainter *painter, const QPalette &pal,
|
|||||||
bool active,
|
bool active,
|
||||||
bool hovered) const
|
bool hovered) const
|
||||||
{
|
{
|
||||||
QStyleOptionViewItemV2 opt;
|
Q_UNUSED(active);
|
||||||
opt.rect = rect;
|
Q_UNUSED(hovered);
|
||||||
opt.state = QStyle::State_Active | QStyle::State_Item | QStyle::State_Children;
|
|
||||||
|
|
||||||
if (expanded)
|
painter->save();
|
||||||
opt.state |= QStyle::State_Open;
|
painter->setPen(Qt::NoPen);
|
||||||
|
|
||||||
if (active)
|
int size = rect.size().width();
|
||||||
opt.state |= QStyle::State_MouseOver | QStyle::State_Enabled | QStyle::State_Selected;
|
int sqsize = 2*(size/2);
|
||||||
|
|
||||||
if (hovered)
|
QColor textColor = pal.buttonText().color();
|
||||||
opt.palette.setBrush(QPalette::Window, pal.highlight());
|
QColor brushColor = textColor;
|
||||||
|
|
||||||
QStyle *s = style();
|
textColor.setAlpha(100);
|
||||||
|
brushColor.setAlpha(40);
|
||||||
|
|
||||||
if (ManhattanStyle *ms = qobject_cast<ManhattanStyle*>(s))
|
QPolygon a;
|
||||||
s = ms->systemStyle();
|
if (expanded) {
|
||||||
|
// down arrow
|
||||||
|
a.setPoints(3, 0, sqsize/3, sqsize/2, sqsize - sqsize/3, sqsize, sqsize/3);
|
||||||
|
} else {
|
||||||
|
// right arrow
|
||||||
|
a.setPoints(3, sqsize - sqsize/3, sqsize/2, sqsize/2 - sqsize/3, 0, sqsize/2 - sqsize/3, sqsize);
|
||||||
|
painter->setBrush(brushColor);
|
||||||
|
}
|
||||||
|
painter->translate(0.5, 0.5);
|
||||||
|
painter->setRenderHint(QPainter::Antialiasing);
|
||||||
|
painter->translate(rect.topLeft());
|
||||||
|
|
||||||
// QGtkStyle needs a small correction to draw the marker in the right place
|
painter->setPen(textColor);
|
||||||
if (qstrcmp(s->metaObject()->className(), "QGtkStyle") == 0)
|
|
||||||
opt.rect.translate(-2, 0);
|
|
||||||
else if (qstrcmp(s->metaObject()->className(), "QMacStyle") == 0)
|
|
||||||
opt.rect.translate(-1, 0);
|
|
||||||
|
|
||||||
s->drawPrimitive(QStyle::PE_IndicatorBranch, &opt, painter, this);
|
|
||||||
|
|
||||||
|
painter->drawPolygon(a);
|
||||||
|
painter->restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseTextEditor::slotModificationChanged(bool m)
|
void BaseTextEditor::slotModificationChanged(bool m)
|
||||||
@@ -2712,8 +2725,7 @@ void BaseTextEditor::extraAreaMouseEvent(QMouseEvent *e)
|
|||||||
d->extraAreaHighlightCollapseBlockNumber = -1;
|
d->extraAreaHighlightCollapseBlockNumber = -1;
|
||||||
d->extraAreaHighlightCollapseColumn = -1;
|
d->extraAreaHighlightCollapseColumn = -1;
|
||||||
|
|
||||||
int collapseBoxWidth = fontMetrics().lineSpacing() + 1;
|
if (e->pos().x() > extraArea()->width() - collapseBoxWidth(fontMetrics())) {
|
||||||
if (e->pos().x() > extraArea()->width() - collapseBoxWidth) {
|
|
||||||
d->extraAreaHighlightCollapseBlockNumber = cursor.blockNumber();
|
d->extraAreaHighlightCollapseBlockNumber = cursor.blockNumber();
|
||||||
if (TextBlockUserData::canCollapse(cursor.block())
|
if (TextBlockUserData::canCollapse(cursor.block())
|
||||||
|| !TextBlockUserData::hasClosingCollapse(cursor.block()))
|
|| !TextBlockUserData::hasClosingCollapse(cursor.block()))
|
||||||
@@ -2739,8 +2751,8 @@ void BaseTextEditor::extraAreaMouseEvent(QMouseEvent *e)
|
|||||||
|
|
||||||
if (e->type() == QEvent::MouseButtonPress || e->type() == QEvent::MouseButtonDblClick) {
|
if (e->type() == QEvent::MouseButtonPress || e->type() == QEvent::MouseButtonDblClick) {
|
||||||
if (e->button() == Qt::LeftButton) {
|
if (e->button() == Qt::LeftButton) {
|
||||||
int collapseBoxWidth = fontMetrics().lineSpacing() + 1;
|
int boxWidth = collapseBoxWidth(fontMetrics());
|
||||||
if (d->m_codeFoldingVisible && e->pos().x() > extraArea()->width() - collapseBoxWidth) {
|
if (d->m_codeFoldingVisible && e->pos().x() > extraArea()->width() - boxWidth) {
|
||||||
if (!cursor.block().next().isVisible()) {
|
if (!cursor.block().next().isVisible()) {
|
||||||
toggleBlockVisible(cursor.block());
|
toggleBlockVisible(cursor.block());
|
||||||
d->moveCursorVisible(false);
|
d->moveCursorVisible(false);
|
||||||
|
|||||||
@@ -102,6 +102,7 @@ class VCSBaseDiffEditorEditable : public VCSBaseEditorEditable
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
VCSBaseDiffEditorEditable(VCSBaseEditor *, const VCSBaseEditorParameters *type);
|
VCSBaseDiffEditorEditable(VCSBaseEditor *, const VCSBaseEditorParameters *type);
|
||||||
|
~VCSBaseDiffEditorEditable();
|
||||||
|
|
||||||
virtual QToolBar *toolBar() { return m_toolBar; }
|
virtual QToolBar *toolBar() { return m_toolBar; }
|
||||||
QComboBox *diffFileBrowseComboBox() const { return m_diffFileBrowseComboBox; }
|
QComboBox *diffFileBrowseComboBox() const { return m_diffFileBrowseComboBox; }
|
||||||
@@ -109,14 +110,14 @@ public:
|
|||||||
bool isTemporary() const { return true; }
|
bool isTemporary() const { return true; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QComboBox *m_diffFileBrowseComboBox;
|
|
||||||
QToolBar *m_toolBar;
|
QToolBar *m_toolBar;
|
||||||
|
QComboBox *m_diffFileBrowseComboBox;
|
||||||
};
|
};
|
||||||
|
|
||||||
VCSBaseDiffEditorEditable::VCSBaseDiffEditorEditable(VCSBaseEditor *e, const VCSBaseEditorParameters *type) :
|
VCSBaseDiffEditorEditable::VCSBaseDiffEditorEditable(VCSBaseEditor *e, const VCSBaseEditorParameters *type) :
|
||||||
VCSBaseEditorEditable(e, type),
|
VCSBaseEditorEditable(e, type),
|
||||||
m_diffFileBrowseComboBox(new QComboBox),
|
m_toolBar(new QToolBar),
|
||||||
m_toolBar(new QToolBar)
|
m_diffFileBrowseComboBox(new QComboBox(m_toolBar))
|
||||||
{
|
{
|
||||||
m_diffFileBrowseComboBox->setMinimumContentsLength(20);
|
m_diffFileBrowseComboBox->setMinimumContentsLength(20);
|
||||||
m_diffFileBrowseComboBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
m_diffFileBrowseComboBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||||
@@ -127,6 +128,11 @@ VCSBaseDiffEditorEditable::VCSBaseDiffEditorEditable(VCSBaseEditor *e, const VCS
|
|||||||
m_toolBar->addWidget(m_diffFileBrowseComboBox);
|
m_toolBar->addWidget(m_diffFileBrowseComboBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VCSBaseDiffEditorEditable::~VCSBaseDiffEditorEditable()
|
||||||
|
{
|
||||||
|
delete m_toolBar;
|
||||||
|
}
|
||||||
|
|
||||||
// ----------- VCSBaseEditorPrivate
|
// ----------- VCSBaseEditorPrivate
|
||||||
|
|
||||||
struct VCSBaseEditorPrivate
|
struct VCSBaseEditorPrivate
|
||||||
|
|||||||
@@ -429,6 +429,8 @@ void BookmarkWidget::setup(bool showButtons)
|
|||||||
vlayout->addWidget(label);
|
vlayout->addWidget(label);
|
||||||
|
|
||||||
searchField = new QLineEdit(this);
|
searchField = new QLineEdit(this);
|
||||||
|
setFocusProxy(searchField);
|
||||||
|
searchField->installEventFilter(this);
|
||||||
vlayout->addWidget(searchField);
|
vlayout->addWidget(searchField);
|
||||||
connect(searchField, SIGNAL(textChanged(const QString &)), this,
|
connect(searchField, SIGNAL(textChanged(const QString &)), this,
|
||||||
SLOT(filterChanged()));
|
SLOT(filterChanged()));
|
||||||
@@ -509,19 +511,6 @@ void BookmarkWidget::expandItems()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BookmarkWidget::focusInEvent(QFocusEvent *e)
|
|
||||||
{
|
|
||||||
if (e->reason() != Qt::MouseFocusReason) {
|
|
||||||
searchField->selectAll();
|
|
||||||
searchField->setFocus();
|
|
||||||
|
|
||||||
QModelIndex index = treeView->indexAt(QPoint(1, 1));
|
|
||||||
if (index.isValid())
|
|
||||||
treeView->setCurrentIndex(index);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BookmarkWidget::eventFilter(QObject *object, QEvent *e)
|
bool BookmarkWidget::eventFilter(QObject *object, QEvent *e)
|
||||||
{
|
{
|
||||||
if ((object == this) || (object == treeView->viewport())) {
|
if ((object == this) || (object == treeView->viewport())) {
|
||||||
@@ -576,6 +565,15 @@ bool BookmarkWidget::eventFilter(QObject *object, QEvent *e)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (object == searchField && e->type() == QEvent::FocusIn) {
|
||||||
|
if (static_cast<QFocusEvent *>(e)->reason() != Qt::MouseFocusReason) {
|
||||||
|
searchField->selectAll();
|
||||||
|
searchField->setFocus();
|
||||||
|
|
||||||
|
QModelIndex index = treeView->indexAt(QPoint(1, 1));
|
||||||
|
if (index.isValid())
|
||||||
|
treeView->setCurrentIndex(index);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return QWidget::eventFilter(object, e);
|
return QWidget::eventFilter(object, e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -129,7 +129,6 @@ private slots:
|
|||||||
private:
|
private:
|
||||||
void setup(bool showButtons);
|
void setup(bool showButtons);
|
||||||
void expandItems();
|
void expandItems();
|
||||||
void focusInEvent(QFocusEvent *e);
|
|
||||||
bool eventFilter(QObject *object, QEvent *event);
|
bool eventFilter(QObject *object, QEvent *event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -43,8 +43,10 @@ ContentWindow::ContentWindow(QHelpEngine *helpEngine)
|
|||||||
, m_expandDepth(-2)
|
, m_expandDepth(-2)
|
||||||
{
|
{
|
||||||
m_contentWidget = m_helpEngine->contentWidget();
|
m_contentWidget = m_helpEngine->contentWidget();
|
||||||
|
m_contentWidget->installEventFilter(this);
|
||||||
m_contentWidget->viewport()->installEventFilter(this);
|
m_contentWidget->viewport()->installEventFilter(this);
|
||||||
m_contentWidget->setContextMenuPolicy(Qt::CustomContextMenu);
|
m_contentWidget->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
|
setFocusProxy(m_contentWidget);
|
||||||
|
|
||||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
QVBoxLayout *layout = new QVBoxLayout(this);
|
||||||
layout->setMargin(4);
|
layout->setMargin(4);
|
||||||
@@ -90,18 +92,6 @@ void ContentWindow::expandToDepth(int depth)
|
|||||||
m_contentWidget->expandToDepth(depth);
|
m_contentWidget->expandToDepth(depth);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContentWindow::focusInEvent(QFocusEvent *e)
|
|
||||||
{
|
|
||||||
if (e->reason() != Qt::MouseFocusReason)
|
|
||||||
m_contentWidget->setFocus();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ContentWindow::keyPressEvent(QKeyEvent *e)
|
|
||||||
{
|
|
||||||
if (e->key() == Qt::Key_Escape)
|
|
||||||
emit escapePressed();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ContentWindow::eventFilter(QObject *o, QEvent *e)
|
bool ContentWindow::eventFilter(QObject *o, QEvent *e)
|
||||||
{
|
{
|
||||||
if (m_contentWidget && o == m_contentWidget->viewport()
|
if (m_contentWidget && o == m_contentWidget->viewport()
|
||||||
@@ -125,6 +115,9 @@ bool ContentWindow::eventFilter(QObject *o, QEvent *e)
|
|||||||
itemClicked(index);
|
itemClicked(index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (o == m_contentWidget && e->type() == QEvent::KeyPress) {
|
||||||
|
if (static_cast<QKeyEvent *>(e)->key() == Qt::Key_Escape)
|
||||||
|
emit escapePressed();
|
||||||
}
|
}
|
||||||
return QWidget::eventFilter(o, e);
|
return QWidget::eventFilter(o, e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,8 +63,6 @@ private slots:
|
|||||||
void itemClicked(const QModelIndex &index);
|
void itemClicked(const QModelIndex &index);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void focusInEvent(QFocusEvent *e);
|
|
||||||
void keyPressEvent(QKeyEvent *e);
|
|
||||||
bool eventFilter(QObject *o, QEvent *e);
|
bool eventFilter(QObject *o, QEvent *e);
|
||||||
bool isPdfFile(QHelpContentItem *item) const;
|
bool isPdfFile(QHelpContentItem *item) const;
|
||||||
|
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ IndexWindow::IndexWindow(QHelpEngine *helpEngine, QWidget *parent)
|
|||||||
|
|
||||||
m_searchLineEdit = new QLineEdit();
|
m_searchLineEdit = new QLineEdit();
|
||||||
l->setBuddy(m_searchLineEdit);
|
l->setBuddy(m_searchLineEdit);
|
||||||
|
setFocusProxy(m_searchLineEdit);
|
||||||
connect(m_searchLineEdit, SIGNAL(textChanged(QString)), this,
|
connect(m_searchLineEdit, SIGNAL(textChanged(QString)), this,
|
||||||
SLOT(filterIndices(QString)));
|
SLOT(filterIndices(QString)));
|
||||||
m_searchLineEdit->installEventFilter(this);
|
m_searchLineEdit->installEventFilter(this);
|
||||||
@@ -112,6 +113,11 @@ bool IndexWindow::eventFilter(QObject *obj, QEvent *e)
|
|||||||
break;
|
break;
|
||||||
default: ; // stop complaining
|
default: ; // stop complaining
|
||||||
}
|
}
|
||||||
|
} else if (obj == m_searchLineEdit
|
||||||
|
&& e->type() == QEvent::FocusIn
|
||||||
|
&& static_cast<QFocusEvent *>(e)->reason() != Qt::MouseFocusReason) {
|
||||||
|
m_searchLineEdit->selectAll();
|
||||||
|
m_searchLineEdit->setFocus();
|
||||||
} else if (obj == m_indexWidget && e->type() == QEvent::ContextMenu) {
|
} else if (obj == m_indexWidget && e->type() == QEvent::ContextMenu) {
|
||||||
QContextMenuEvent *ctxtEvent = static_cast<QContextMenuEvent*>(e);
|
QContextMenuEvent *ctxtEvent = static_cast<QContextMenuEvent*>(e);
|
||||||
QModelIndex idx = m_indexWidget->indexAt(ctxtEvent->pos());
|
QModelIndex idx = m_indexWidget->indexAt(ctxtEvent->pos());
|
||||||
@@ -147,6 +153,7 @@ bool IndexWindow::eventFilter(QObject *obj, QEvent *e)
|
|||||||
m_indexWidget->activateCurrentItem();
|
m_indexWidget->activateCurrentItem();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return QWidget::eventFilter(obj, e);
|
return QWidget::eventFilter(obj, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -166,14 +173,6 @@ void IndexWindow::setSearchLineEditText(const QString &text)
|
|||||||
m_searchLineEdit->setText(text);
|
m_searchLineEdit->setText(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IndexWindow::focusInEvent(QFocusEvent *e)
|
|
||||||
{
|
|
||||||
if (e->reason() != Qt::MouseFocusReason) {
|
|
||||||
m_searchLineEdit->selectAll();
|
|
||||||
m_searchLineEdit->setFocus();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void IndexWindow::open(QHelpIndexWidget* indexWidget, const QModelIndex &index)
|
void IndexWindow::open(QHelpIndexWidget* indexWidget, const QModelIndex &index)
|
||||||
{
|
{
|
||||||
QHelpIndexModel *model = qobject_cast<QHelpIndexModel*>(indexWidget->model());
|
QHelpIndexModel *model = qobject_cast<QHelpIndexModel*>(indexWidget->model());
|
||||||
|
|||||||
@@ -69,7 +69,6 @@ private slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
bool eventFilter(QObject *obj, QEvent *e);
|
bool eventFilter(QObject *obj, QEvent *e);
|
||||||
void focusInEvent(QFocusEvent *e);
|
|
||||||
void open(QHelpIndexWidget* indexWidget, const QModelIndex &index);
|
void open(QHelpIndexWidget* indexWidget, const QModelIndex &index);
|
||||||
|
|
||||||
QLineEdit *m_searchLineEdit;
|
QLineEdit *m_searchLineEdit;
|
||||||
|
|||||||
Reference in New Issue
Block a user