logic: fixed warnings, tests and bugs

* fixed clang warnings
* fixed cxxparser tests
* added missing checks for valid location in ASTVisitor callbacks for templates
* removed warning when statusbar view is removed
* made font of activated classes bold
* fixed search box not responding to autocompletion tab or enter press
* fixed search box not updated when active token changes
This commit is contained in:
Eberhard Graether
2014-12-02 00:55:57 +01:00
parent 3b7b02ff8c
commit c54c405dd1
15 changed files with 158 additions and 113 deletions
+4 -3
View File
@@ -166,9 +166,6 @@ QtAutocompletionList::QtAutocompletionList(QWidget* parent)
setCaseSensitivity(Qt::CaseInsensitive);
// setCompletionMode(QCompleter::UnfilteredPopupCompletion);
connect(this, SIGNAL(highlighted(const QModelIndex&)), this, SLOT(onHighlighted(const QModelIndex&)), Qt::DirectConnection);
connect(this, SIGNAL(activated(const QModelIndex&)), this, SLOT(onActivated(const QModelIndex&)), Qt::DirectConnection);
}
QtAutocompletionList::~QtAutocompletionList()
@@ -202,6 +199,10 @@ void QtAutocompletionList::completeAt(const QPoint& pos, const std::vector<Searc
list->verticalScrollBar()->setValue(list->verticalScrollBar()->minimum());
list->setCurrentIndex(index); // must be set again to avoid flickering
disconnect(); // must be done because of a bug where signals are no longer received by QtSmartSearchBox
connect(this, SIGNAL(highlighted(const QModelIndex&)), this, SLOT(onHighlighted(const QModelIndex&)), Qt::DirectConnection);
connect(this, SIGNAL(activated(const QModelIndex&)), this, SLOT(onActivated(const QModelIndex&)), Qt::DirectConnection);
}
const SearchMatch* QtAutocompletionList::getSearchMatchAt(int idx) const
+3 -3
View File
@@ -52,9 +52,6 @@ QtSmartSearchBox::QtSmartSearchBox(QWidget* parent)
QCompleter* completer = new QtAutocompletionList(this);
setCompleter(completer);
connect(completer, SIGNAL(matchHighlighted(const SearchMatch&)), this, SLOT(onAutocompletionHighlighted(const SearchMatch&)), Qt::DirectConnection);
connect(completer, SIGNAL(matchActivated(const SearchMatch&)), this, SLOT(onAutocompletionActivated(const SearchMatch&)), Qt::DirectConnection);
updatePlaceholder();
}
@@ -66,6 +63,9 @@ void QtSmartSearchBox::setAutocompletionList(const std::vector<SearchMatch>& aut
{
QtAutocompletionList* completer = dynamic_cast<QtAutocompletionList*>(this->completer());
completer->completeAt(QPoint(textMargins().left() + 3, height() + 3), autocompletionList);
connect(completer, SIGNAL(matchHighlighted(const SearchMatch&)), this, SLOT(onAutocompletionHighlighted(const SearchMatch&)), Qt::DirectConnection);
connect(completer, SIGNAL(matchActivated(const SearchMatch&)), this, SLOT(onAutocompletionActivated(const SearchMatch&)), Qt::DirectConnection);
}
void QtSmartSearchBox::setQuery(const std::string& text)
+2 -2
View File
@@ -1,8 +1,9 @@
#include "qt/view/QtMainView.h"
#include "qt/element/QtMainWindow.h"
#include "utility/logging/logging.h"
#include "qt/element/QtMainWindow.h"
QtMainView::QtMainView()
{
m_window = std::make_shared<QtMainWindow>();
@@ -24,7 +25,6 @@ void QtMainView::removeView(View* view)
std::vector<View*>::iterator it = std::find(m_views.begin(), m_views.end(), view);
if (it == m_views.end())
{
LOG_ERROR("View was not found.");
return;
}
@@ -28,6 +28,7 @@ QFont QtGraphNode::getFontForNodeType(Node::NodeType type)
case Node::NODE_CLASS:
case Node::NODE_ENUM:
case Node::NODE_TYPEDEF:
case Node::NODE_TEMPLATE_PARAMETER_TYPE:
font.setPixelSize(14);
break;
@@ -284,6 +285,11 @@ void QtGraphNode::setStyle()
case Node::NODE_ENUM:
case Node::NODE_TYPEDEF:
case Node::NODE_TEMPLATE_PARAMETER_TYPE:
if (m_isActive)
{
font.setWeight(QFont::Bold);
}
if (m_isHovering)
{
m_rect->setShadow(QColor(0, 0, 0, 255), 5);