Gui: Use auto and range-based for (#7481)
* On lines where the variable type is obvious from inspection, avoid repeating the type using auto. * When possible use a ranged for loop instead of begin() and end() iterators
This commit is contained in:
@@ -44,22 +44,22 @@ TextEdit::TextEdit(QWidget* parent)
|
||||
{
|
||||
//Note: Set the correct context to this shortcut as we may use several instances of this
|
||||
//class at a time
|
||||
QShortcut* shortcut = new QShortcut(this);
|
||||
auto shortcut = new QShortcut(this);
|
||||
shortcut->setKey(QKeySequence(QString::fromLatin1("CTRL+Space")));
|
||||
shortcut->setContext(Qt::WidgetShortcut);
|
||||
connect(shortcut, SIGNAL(activated()), this, SLOT(complete()));
|
||||
|
||||
QShortcut* shortcutFind = new QShortcut(this);
|
||||
auto shortcutFind = new QShortcut(this);
|
||||
shortcutFind->setKey(QKeySequence::Find);
|
||||
shortcutFind->setContext(Qt::WidgetShortcut);
|
||||
connect(shortcutFind, SIGNAL(activated()), this, SIGNAL(showSearchBar()));
|
||||
|
||||
QShortcut* shortcutNext = new QShortcut(this);
|
||||
auto shortcutNext = new QShortcut(this);
|
||||
shortcutNext->setKey(QKeySequence::FindNext);
|
||||
shortcutNext->setContext(Qt::WidgetShortcut);
|
||||
connect(shortcutNext, SIGNAL(activated()), this, SIGNAL(findNext()));
|
||||
|
||||
QShortcut* shortcutPrev = new QShortcut(this);
|
||||
auto shortcutPrev = new QShortcut(this);
|
||||
shortcutPrev->setKey(QKeySequence::FindPrevious);
|
||||
shortcutPrev->setContext(Qt::WidgetShortcut);
|
||||
connect(shortcutPrev, SIGNAL(activated()), this, SIGNAL(findPrevious()));
|
||||
@@ -290,7 +290,7 @@ void TextEditor::highlightCurrentLine()
|
||||
QColor lineColor = d->colormap[QLatin1String("Current line highlight")];
|
||||
unsigned int col = (lineColor.red() << 24) | (lineColor.green() << 16) | (lineColor.blue() << 8);
|
||||
ParameterGrp::handle hPrefGrp = getWindowParameter();
|
||||
unsigned long value = static_cast<unsigned long>(col);
|
||||
auto value = static_cast<unsigned long>(col);
|
||||
value = hPrefGrp->GetUnsigned( "Current line highlight", value);
|
||||
col = static_cast<unsigned int>(value);
|
||||
lineColor.setRgb((col>>24)&0xff, (col>>16)&0xff, (col>>8)&0xff);
|
||||
@@ -454,7 +454,7 @@ void TextEditor::OnChange(Base::Subject<const char*> &rCaller,const char* sReaso
|
||||
if (it != d->colormap.end()) {
|
||||
QColor color = it.value();
|
||||
unsigned int col = (color.red() << 24) | (color.green() << 16) | (color.blue() << 8);
|
||||
unsigned long value = static_cast<unsigned long>(col);
|
||||
auto value = static_cast<unsigned long>(col);
|
||||
value = hPrefGrp->GetUnsigned(sReason, value);
|
||||
col = static_cast<unsigned int>(value);
|
||||
color.setRgb((col>>24)&0xff, (col>>16)&0xff, (col>>8)&0xff);
|
||||
@@ -565,7 +565,7 @@ bool CompletionList::eventFilter(QObject * watched, QEvent * event)
|
||||
hide();
|
||||
} else if (isVisible() && watched == textEdit) {
|
||||
if (event->type() == QEvent::KeyPress) {
|
||||
QKeyEvent* ke = (QKeyEvent*)event;
|
||||
auto ke = (QKeyEvent*)event;
|
||||
if (ke->key() == Qt::Key_Up || ke->key() == Qt::Key_Down) {
|
||||
keyPressEvent(ke);
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user