2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

fixed online display, fixed reading messages on idle

This commit is contained in:
John Preston
2014-06-20 11:06:21 +04:00
parent d68aeb1b49
commit e0a364dd0f
14 changed files with 77 additions and 31 deletions

View File

@@ -41,7 +41,7 @@ namespace {
FlatInputStyle _flatInputStyle;
}
FlatInput::FlatInput(QWidget *parent, const style::flatInput &st, const QString &pholder, const QString &v) : QLineEdit(v, parent), _oldtext(v), _kev(0), _phVisible(!v.length()),
FlatInput::FlatInput(QWidget *parent, const style::flatInput &st, const QString &pholder, const QString &v) : QLineEdit(v, parent), _oldtext(v), _kev(0), _customUpDown(false), _phVisible(!v.length()),
a_phLeft(_phVisible ? 0 : st.phShift), a_phAlpha(_phVisible ? 1 : 0), a_phColor(st.phColor->c),
a_borderColor(st.borderColor->c), a_bgColor(st.bgColor->c), _notingBene(0), _st(st) {
resize(_st.width, _st.height);
@@ -67,6 +67,10 @@ FlatInput::FlatInput(QWidget *parent, const style::flatInput &st, const QString
connect(&_touchTimer, SIGNAL(timeout()), this, SLOT(onTouchTimer()));
}
void FlatInput::customUpDown(bool custom) {
_customUpDown = custom;
}
void FlatInput::onTouchTimer() {
_touchRightButton = true;
}
@@ -231,7 +235,12 @@ void FlatInput::correctValue(QKeyEvent *e, const QString &was) {
void FlatInput::keyPressEvent(QKeyEvent *e) {
QString was(text());
_kev = e;
QLineEdit::keyPressEvent(e);
if (_customUpDown && (e->key() == Qt::Key_Up || e->key() == Qt::Key_Down)) {
e->ignore();
} else {
QLineEdit::keyPressEvent(e);
}
if (was == text()) { // call correct manually
correctValue(_kev, was);
_oldtext = text();

View File

@@ -47,6 +47,8 @@ public:
QSize sizeHint() const;
QSize minimumSizeHint() const;
void customUpDown(bool isCustom);
public slots:
void onTextChange(const QString &text);
@@ -71,6 +73,8 @@ private:
QString _ph, _oldtext;
QKeyEvent *_kev;
bool _customUpDown;
bool _phVisible;
anim::ivalue a_phLeft;
anim::fvalue a_phAlpha;