getting rid of tons of warnings

This commit is contained in:
confuseh 2017-01-18 13:48:42 +00:00
parent 528f539fca
commit 5eb7349b57
13 changed files with 98 additions and 69 deletions

View file

@ -112,7 +112,8 @@ HEADERS += mainwindow.h \
chatwidgetheaderbutton.h \
chatwidgetheaderbuttonlabel.h \
channels.h \
textinputdialog.h
textinputdialog.h \
signallabel.h
PRECOMPILED_HEADER =

View file

@ -60,10 +60,13 @@ ChatWidgetHeader::ChatWidgetHeader(ChatWidget *parent)
// middle
this->middleLabel.setAlignment(Qt::AlignCenter);
QObject::connect(&this->middleLabel,
SIGNAL(mouseDoubleClickEvent(QMouseEvent)), this,
SLOT(mouseDoubleClickEvent));
/*QObject::connect(&this->middleLabel,
* SIGNAL(mouseDoubleClickEvent(QMouseEvent)), this,
* SLOT(mouseDoubleClickEvent));
* mouseDoubleClickEvent is not a signal, its an event handler
*/
connect(&this->middleLabel, &SignalLabel::mouseDoubleClick, this, &ChatWidgetHeader::mouseDoubleClickEvent);
// right
this->rightLabel.setMinimumWidth(height());
this->rightLabel.getLabel().setTextFormat(Qt::RichText);

View file

@ -2,6 +2,7 @@
#define CHATWIDGETHEADER_H
#include "chatwidgetheaderbutton.h"
#include "signallabel.h"
#include <QAction>
#include <QHBoxLayout>
@ -45,7 +46,7 @@ private:
QHBoxLayout hbox;
ChatWidgetHeaderButton leftLabel;
QLabel middleLabel;
SignalLabel middleLabel;
ChatWidgetHeaderButton rightLabel;
QMenu leftMenu;

View file

@ -6,6 +6,7 @@
#include "word.h"
#include "wordpart.h"
#include <math.h>
#include <QPainter>
#include <QScroller>
#include <functional>
@ -105,7 +106,7 @@ ChatWidgetView::paintEvent(QPaintEvent *)
}
int y = -(messages[start].get()->getHeight() *
(std::fmod(this->scrollbar.getValue(), 1)));
(fmod(this->scrollbar.getValue(), 1)));
for (int i = start; i < messages.size(); ++i) {
Message *message = messages[i].get();

View file

@ -464,7 +464,7 @@ Message::layout(int width, bool enableEmoteMargins)
bool first = true;
auto alignParts = [&lineStart, &lineHeight, &parts, this] {
for (int i = lineStart; i < parts->size(); i++) {
for (size_t i = lineStart; i < parts->size(); i++) {
WordPart &wordPart2 = parts->at(i);
wordPart2.setY(wordPart2.getY() + lineHeight);
@ -510,7 +510,7 @@ Message::layout(int width, bool enableEmoteMargins)
charWidths.reserve(text.length());
for (int i = 0; i < text.length(); i++) {
charWidths.push_back(metrics.charWidth(text, i));
charWidths.push_back(metrics.width(text, i));
}
}

View file

@ -16,8 +16,8 @@ std::pair<int, int> NotebookPage::dropPosition = std::pair<int, int>(-1, -1);
NotebookPage::NotebookPage(QWidget *parent, NotebookTab *tab)
: QWidget(parent)
, parentbox(this)
, preview(this)
, chatWidgets()
, preview(this)
{
this->tab = tab;
tab->page = this;

View file

@ -37,9 +37,9 @@ public:
protected:
void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
void enterEvent(QEvent *);
void leaveEvent(QEvent *);
void mouseReleaseEvent(QMouseEvent *event);
void enterEvent(QEvent *) override;
void leaveEvent(QEvent *) override;
void mouseReleaseEvent(QMouseEvent *event) override;
void dragEnterEvent(QDragEnterEvent *event) Q_DECL_OVERRIDE;
void dragMoveEvent(QDragMoveEvent *event) Q_DECL_OVERRIDE;

View file

@ -21,71 +21,71 @@ public:
void
setMaximum(qreal value)
{
maximum = value;
this->maximum = value;
updateScroll();
this->updateScroll();
}
void
setMinimum(qreal value)
{
minimum = value;
this->minimum = value;
updateScroll();
this->updateScroll();
}
void
setLargeChange(qreal value)
{
largeChange = value;
this->largeChange = value;
updateScroll();
this->updateScroll();
}
void
setSmallChange(qreal value)
{
smallChange = value;
this->smallChange = value;
updateScroll();
this->updateScroll();
}
void
setValue(qreal value)
{
value = value;
this->value = value;
updateScroll();
this->updateScroll();
}
qreal
getMaximum() const
{
return maximum;
return this->maximum;
}
qreal
getMinimum() const
{
return minimum;
return this->minimum;
}
qreal
getLargeChange() const
{
return largeChange;
return this->largeChange;
}
qreal
getSmallChange() const
{
return smallChange;
return this->smallChange;
}
qreal
getValue() const
{
return value;
return this->value;
}
private:

View file

@ -18,23 +18,23 @@ public:
void
setSelected(bool selected)
{
if (selected == selected)
if (this->selected == selected)
return;
selected = selected;
this->selected = selected;
emit selectedChanged(selected);
}
bool
getSelected() const
{
return selected;
return this->selected;
}
QWidget *
getWidget()
{
return widget;
return this->widget;
}
void

23
signallabel.h Normal file
View file

@ -0,0 +1,23 @@
#ifndef SIGNALLABEL_H
#define SIGNALLABEL_H
#include <QFlags>
#include <QLabel>
#include <QWidget>
class SignalLabel : public QLabel
{
Q_OBJECT
public:
explicit SignalLabel(QWidget *parent = 0, Qt::WindowFlags f = 0)
: QLabel(parent, f) {}
virtual ~SignalLabel() = default;
signals:
void mouseDoubleClick(QMouseEvent *ev);
protected:
virtual void mouseDoubleClickEvent(QMouseEvent *ev) override {
emit this->mouseDoubleClick(ev);
}
};
#endif // SIGNALLABEL_H

40
word.h
View file

@ -77,111 +77,111 @@ public:
const QString &
getText() const
{
return text;
return this->text;
}
int
getWidth() const
{
return width;
return this->width;
}
int
getHeight() const
{
return height;
return this->height;
}
void
setSize(int width, int height)
{
width = width;
height = height;
this->width = width;
this->height = height;
}
bool
isImage() const
{
return _isImage;
return this->_isImage;
}
bool
isText() const
{
return !_isImage;
return !this->_isImage;
}
const QString &
getCopyText() const
{
return copyText;
return this->copyText;
}
bool
hasTrailingSpace() const
{
return _hasTrailingSpace;
return this->_hasTrailingSpace;
}
QFont &
getFont() const
{
return Fonts::getFont(font);
return Fonts::getFont(this->font);
}
QFontMetrics &
getFontMetrics() const
{
return Fonts::getFontMetrics(font);
return Fonts::getFontMetrics(this->font);
}
Type
getType() const
{
return type;
return this->type;
}
const QString &
getTooltip() const
{
return tooltip;
return this->tooltip;
}
const QColor &
getColor() const
{
return color;
return this->color;
}
const Link &
getLink() const
{
return link;
return this->link;
}
int
getXOffset() const
{
return xOffset;
return this->xOffset;
}
int
getYOffset() const
{
return yOffset;
return this->yOffset;
}
void
setOffset(int xOffset, int yOffset)
{
xOffset = std::max(0, xOffset);
yOffset = std::max(0, yOffset);
this->xOffset = std::max(0, xOffset);
this->yOffset = std::max(0, yOffset);
}
std::vector<short> &
getCharacterWidthCache()
{
return characterWidthCache;
return this->characterWidthCache;
}
private:

View file

@ -5,12 +5,12 @@ WordPart::WordPart(Word &word, int x, int y, const QString &copyText,
bool allowTrailingSpace)
: m_word(word)
, copyText(copyText)
, text(word.isText() ? m_word.getText() : QString())
, x(x)
, y(y)
, width(word.getWidth())
, height(word.getHeight())
, _trailingSpace(word.hasTrailingSpace() & allowTrailingSpace)
, text(word.isText() ? m_word.getText() : QString())
{
}
@ -19,11 +19,11 @@ WordPart::WordPart(Word &word, int x, int y, int width, int height,
bool allowTrailingSpace)
: m_word(word)
, copyText(copyText)
, text(customText)
, x(x)
, y(y)
, width(width)
, height(height)
, _trailingSpace(word.hasTrailingSpace() & allowTrailingSpace)
, text(customText)
{
}

View file

@ -19,84 +19,84 @@ public:
const Word &
getWord() const
{
return m_word;
return this->m_word;
}
int
getWidth() const
{
return width;
return this->width;
}
int
getHeight() const
{
return height;
return this->height;
}
int
getX() const
{
return x;
return this->x;
}
int
getY() const
{
return y;
return this->y;
}
void
setPosition(int x, int y)
{
x = x;
y = y;
this->x = x;
this->y = y;
}
void
setY(int y)
{
y = y;
this->y = y;
}
int
getRight() const
{
return x + width;
return this->x + this->width;
}
int
getBottom() const
{
return y + height;
return this->y + this->height;
}
QRect
getRect() const
{
return QRect(x, y, width, height);
return QRect(this->x, this->y, this->width, this->height);
}
const QString
getCopyText() const
{
return copyText;
return this->copyText;
}
int
hasTrailingSpace() const
{
return _trailingSpace;
return this->_trailingSpace;
}
const QString &
getText() const
{
return text;
return this->text;
}
private:
Word &m_word;
Word& m_word;
QString copyText;
QString text;