mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 03:00:46 +03:00
Add border line above the text input
This commit is contained in:
parent
7253dc2c54
commit
b70e09c7ec
7 changed files with 32 additions and 19 deletions
|
@ -149,8 +149,6 @@ private:
|
|||
QWidget *communitiesSideBar_;
|
||||
QVBoxLayout *communitiesSideBarLayout_;
|
||||
QVBoxLayout *sideBarLayout_;
|
||||
QVBoxLayout *sideBarTopLayout_;
|
||||
QVBoxLayout *sideBarMainLayout_;
|
||||
QWidget *sideBarTopWidget_;
|
||||
QVBoxLayout *sideBarTopWidgetLayout_;
|
||||
|
||||
|
|
|
@ -83,11 +83,16 @@ class TextInputWidget : public QWidget
|
|||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor)
|
||||
|
||||
public:
|
||||
TextInputWidget(QWidget *parent = 0);
|
||||
|
||||
void stopTyping();
|
||||
|
||||
QColor borderColor() const { return borderColor_; }
|
||||
void setBorderColor(QColor &color) { borderColor_ = color; }
|
||||
|
||||
public slots:
|
||||
void openFileSelection();
|
||||
void hideUploadSpinner();
|
||||
|
@ -126,4 +131,6 @@ private:
|
|||
FlatButton *sendFileBtn_;
|
||||
FlatButton *sendMessageBtn_;
|
||||
emoji::PickButton *emojiBtn_;
|
||||
|
||||
QColor borderColor_;
|
||||
};
|
||||
|
|
|
@ -163,3 +163,7 @@ TopRoomBar {
|
|||
border: none;
|
||||
border-bottom: 1px solid #414A59;
|
||||
}
|
||||
|
||||
TextInputWidget {
|
||||
qproperty-borderColor: #414A59;
|
||||
}
|
||||
|
|
|
@ -146,6 +146,10 @@ TextField {
|
|||
qproperty-labelColor: #333;
|
||||
}
|
||||
|
||||
TextInputWidget {
|
||||
qproperty-borderColor: #dcdcdc;
|
||||
}
|
||||
|
||||
ScrollBar {
|
||||
qproperty-handleColor: #ccc;
|
||||
qproperty-backgroundColor: #efefef;
|
||||
|
|
|
@ -128,3 +128,7 @@ TopRoomBar {
|
|||
border: none;
|
||||
border-bottom: 1px solid palette(text);
|
||||
}
|
||||
|
||||
TextInputWidget {
|
||||
qproperty-borderColor: palette(text);
|
||||
}
|
||||
|
|
|
@ -84,16 +84,6 @@ ChatPage::ChatPage(QSharedPointer<MatrixClient> client,
|
|||
sideBarLayout_->setSpacing(0);
|
||||
sideBarLayout_->setMargin(0);
|
||||
|
||||
sideBarTopLayout_ = new QVBoxLayout();
|
||||
sideBarTopLayout_->setSpacing(0);
|
||||
sideBarTopLayout_->setMargin(0);
|
||||
sideBarMainLayout_ = new QVBoxLayout();
|
||||
sideBarMainLayout_->setSpacing(0);
|
||||
sideBarMainLayout_->setMargin(0);
|
||||
|
||||
sideBarLayout_->addLayout(sideBarTopLayout_);
|
||||
sideBarLayout_->addLayout(sideBarMainLayout_);
|
||||
|
||||
sideBarTopWidget_ = new QWidget(sideBar_);
|
||||
sidebarActions_ = new SideBarActions(this);
|
||||
connect(
|
||||
|
|
|
@ -33,6 +33,8 @@
|
|||
|
||||
static constexpr size_t INPUT_HISTORY_SIZE = 127;
|
||||
static constexpr int MAX_TEXTINPUT_HEIGHT = 120;
|
||||
static constexpr int InputHeight = 26;
|
||||
static constexpr int ButtonHeight = 24;
|
||||
|
||||
FilteredTextEdit::FilteredTextEdit(QWidget *parent)
|
||||
: QTextEdit{parent}
|
||||
|
@ -313,11 +315,11 @@ TextInputWidget::TextInputWidget(QWidget *parent)
|
|||
|
||||
sendFileBtn_ = new FlatButton(this);
|
||||
sendFileBtn_->setIcon(send_file_icon);
|
||||
sendFileBtn_->setIconSize(QSize(24, 24));
|
||||
sendFileBtn_->setIconSize(QSize(ButtonHeight, ButtonHeight));
|
||||
|
||||
spinner_ = new LoadingIndicator(this);
|
||||
spinner_->setFixedHeight(32);
|
||||
spinner_->setFixedWidth(32);
|
||||
spinner_->setFixedHeight(InputHeight);
|
||||
spinner_->setFixedWidth(InputHeight);
|
||||
spinner_->setObjectName("FileUploadSpinner");
|
||||
spinner_->hide();
|
||||
|
||||
|
@ -325,13 +327,13 @@ TextInputWidget::TextInputWidget(QWidget *parent)
|
|||
font.setPixelSize(conf::textInputFontSize);
|
||||
|
||||
input_ = new FilteredTextEdit(this);
|
||||
input_->setFixedHeight(32);
|
||||
input_->setFixedHeight(InputHeight);
|
||||
input_->setFont(font);
|
||||
input_->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
input_->setPlaceholderText(tr("Write a message..."));
|
||||
|
||||
connect(input_, &FilteredTextEdit::heightChanged, this, [this](int height) {
|
||||
int textInputHeight = std::min(MAX_TEXTINPUT_HEIGHT, std::max(height, 32));
|
||||
int textInputHeight = std::min(MAX_TEXTINPUT_HEIGHT, std::max(height, InputHeight));
|
||||
int widgetHeight =
|
||||
std::min(MAX_TEXTINPUT_HEIGHT, std::max(height, conf::textInput::height));
|
||||
|
||||
|
@ -344,14 +346,14 @@ TextInputWidget::TextInputWidget(QWidget *parent)
|
|||
QIcon send_message_icon;
|
||||
send_message_icon.addFile(":/icons/icons/ui/cursor.png");
|
||||
sendMessageBtn_->setIcon(send_message_icon);
|
||||
sendMessageBtn_->setIconSize(QSize(24, 24));
|
||||
sendMessageBtn_->setIconSize(QSize(ButtonHeight, ButtonHeight));
|
||||
|
||||
emojiBtn_ = new emoji::PickButton(this);
|
||||
|
||||
QIcon emoji_icon;
|
||||
emoji_icon.addFile(":/icons/icons/ui/smile.png");
|
||||
emojiBtn_->setIcon(emoji_icon);
|
||||
emojiBtn_->setIconSize(QSize(24, 24));
|
||||
emojiBtn_->setIconSize(QSize(ButtonHeight, ButtonHeight));
|
||||
|
||||
topLayout_->addWidget(sendFileBtn_);
|
||||
topLayout_->addWidget(input_);
|
||||
|
@ -483,5 +485,9 @@ TextInputWidget::paintEvent(QPaintEvent *)
|
|||
QStyleOption opt;
|
||||
opt.init(this);
|
||||
QPainter p(this);
|
||||
|
||||
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
|
||||
|
||||
p.setPen(QPen(borderColor()));
|
||||
p.drawLine(QPointF(0, 0), QPointF(width(), 0));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue