ui: fix codeview scrollbar and search crash
* fixed size policies of codeview elements to prevent the codeview from having a global scrollbar * fixed crash in sorting of search results * removed debug log when panning a codesnippet
This commit is contained in:
@@ -256,6 +256,10 @@ std::vector<SearchMatch> Storage::getAutocompletionMatches(const std::string& qu
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (a.text[i] > b.text[i])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,7 +102,8 @@ QtCodeArea::QtCodeArea(
|
||||
setReadOnly(true);
|
||||
setFrameStyle(QFrame::NoFrame);
|
||||
setLineWrapMode(QPlainTextEdit::NoWrap);
|
||||
setSizePolicy(sizePolicy().horizontalPolicy(), QSizePolicy::Fixed);
|
||||
setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed);
|
||||
|
||||
viewport()->setCursor(Qt::ArrowCursor);
|
||||
|
||||
m_lineNumberArea = new LineNumberArea(this);
|
||||
@@ -161,7 +162,7 @@ QSize QtCodeArea::sizeHint() const
|
||||
height += horizontalScrollBar()->height();
|
||||
}
|
||||
|
||||
return QSize(320, height + 1);
|
||||
return QSize(0, height + 1);
|
||||
}
|
||||
|
||||
uint QtCodeArea::getStartLineNumber() const
|
||||
@@ -459,7 +460,6 @@ void QtCodeArea::mouseMoveEvent(QMouseEvent* event)
|
||||
scrollbar->setValue(scrollbar->value() - utility::roundToInt(deltaPosRatio * scrollbar->pageStep()));
|
||||
|
||||
m_panningDistance += abs(deltaX + deltaY);
|
||||
std::cout << m_panningDistance << std::endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ QtCodeFile::QtCodeFile(const FilePath& filePath, QtCodeFileList* parent)
|
||||
, m_snippetsRequested(false)
|
||||
{
|
||||
setObjectName("code_file");
|
||||
setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed);
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout(this);
|
||||
layout->setMargin(0);
|
||||
|
||||
@@ -40,11 +40,6 @@ QtCodeFileList::~QtCodeFileList()
|
||||
{
|
||||
}
|
||||
|
||||
QSize QtCodeFileList::sizeHint() const
|
||||
{
|
||||
return QSize(800, 800);
|
||||
}
|
||||
|
||||
void QtCodeFileList::addCodeSnippet(
|
||||
const CodeSnippetParams& params,
|
||||
bool insert
|
||||
|
||||
@@ -30,8 +30,6 @@ public:
|
||||
QtCodeFileList(QWidget* parent = 0);
|
||||
virtual ~QtCodeFileList();
|
||||
|
||||
virtual QSize sizeHint() const;
|
||||
|
||||
void addCodeSnippet(const CodeSnippetParams& params, bool insert = false);
|
||||
void addFile(std::shared_ptr<TokenLocationFile> locationFile, int refCount, TimePoint modificationTime);
|
||||
|
||||
|
||||
@@ -171,15 +171,6 @@ std::string QtCodeSnippet::getCode() const
|
||||
return m_codeArea->getCode();
|
||||
}
|
||||
|
||||
void QtCodeSnippet::contextMenuEvent(QContextMenuEvent* event)
|
||||
{
|
||||
// QMenu menu(this);
|
||||
// menu.addAction(new QAction("Bar", this));
|
||||
// menu.addAction(new QAction("Brew Tea", this));
|
||||
// menu.addAction(new QAction("Translate", this));
|
||||
// menu.exec(event->globalPos());
|
||||
}
|
||||
|
||||
void QtCodeSnippet::clickedTitle()
|
||||
{
|
||||
if (m_titleId > 0)
|
||||
|
||||
@@ -47,9 +47,6 @@ public:
|
||||
|
||||
std::string getCode() const;
|
||||
|
||||
protected:
|
||||
virtual void contextMenuEvent(QContextMenuEvent* event) Q_DECL_OVERRIDE;
|
||||
|
||||
private slots:
|
||||
void clickedTitle();
|
||||
void clickedFooter();
|
||||
|
||||
Reference in New Issue
Block a user