mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 19:08:58 +03:00
Adjust the height of the bottom widgets
This commit is contained in:
parent
f58cbd7281
commit
675f1be777
2 changed files with 26 additions and 11 deletions
|
@ -14,7 +14,13 @@
|
||||||
SideBarActions::SideBarActions(QWidget *parent)
|
SideBarActions::SideBarActions(QWidget *parent)
|
||||||
: QWidget{parent}
|
: QWidget{parent}
|
||||||
{
|
{
|
||||||
setFixedHeight(conf::sidebarActions::height);
|
QFont f;
|
||||||
|
f.setPointSizeF(f.pointSizeF());
|
||||||
|
|
||||||
|
const int fontHeight = QFontMetrics(f).height();
|
||||||
|
const int contentHeight = fontHeight * 2.5;
|
||||||
|
|
||||||
|
setFixedHeight(contentHeight);
|
||||||
|
|
||||||
layout_ = new QHBoxLayout(this);
|
layout_ = new QHBoxLayout(this);
|
||||||
layout_->setMargin(0);
|
layout_->setMargin(0);
|
||||||
|
|
|
@ -43,7 +43,6 @@
|
||||||
|
|
||||||
static constexpr size_t INPUT_HISTORY_SIZE = 127;
|
static constexpr size_t INPUT_HISTORY_SIZE = 127;
|
||||||
static constexpr int MAX_TEXTINPUT_HEIGHT = 120;
|
static constexpr int MAX_TEXTINPUT_HEIGHT = 120;
|
||||||
static constexpr int InputHeight = 24;
|
|
||||||
static constexpr int ButtonHeight = 22;
|
static constexpr int ButtonHeight = 22;
|
||||||
|
|
||||||
FilteredTextEdit::FilteredTextEdit(QWidget *parent)
|
FilteredTextEdit::FilteredTextEdit(QWidget *parent)
|
||||||
|
@ -446,7 +445,13 @@ FilteredTextEdit::showPreview(const QMimeData *source, const QStringList &format
|
||||||
TextInputWidget::TextInputWidget(QWidget *parent)
|
TextInputWidget::TextInputWidget(QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
{
|
{
|
||||||
setFixedHeight(conf::textInput::height);
|
QFont f;
|
||||||
|
f.setPointSizeF(f.pointSizeF());
|
||||||
|
const int fontHeight = QFontMetrics(f).height();
|
||||||
|
const int contentHeight = fontHeight * 2.5;
|
||||||
|
const int InputHeight = fontHeight * 1.5;
|
||||||
|
|
||||||
|
setFixedHeight(contentHeight);
|
||||||
setCursor(Qt::ArrowCursor);
|
setCursor(Qt::ArrowCursor);
|
||||||
|
|
||||||
topLayout_ = new QHBoxLayout();
|
topLayout_ = new QHBoxLayout();
|
||||||
|
@ -472,10 +477,14 @@ TextInputWidget::TextInputWidget(QWidget *parent)
|
||||||
input_->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
input_->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
input_->setPlaceholderText(tr("Write a message..."));
|
input_->setPlaceholderText(tr("Write a message..."));
|
||||||
|
|
||||||
connect(input_, &FilteredTextEdit::heightChanged, this, [this](int height) {
|
connect(input_,
|
||||||
int textInputHeight = std::min(MAX_TEXTINPUT_HEIGHT, std::max(height, InputHeight));
|
&FilteredTextEdit::heightChanged,
|
||||||
|
this,
|
||||||
|
[this, InputHeight, contentHeight](int height) {
|
||||||
|
int textInputHeight =
|
||||||
|
std::min(MAX_TEXTINPUT_HEIGHT, std::max(height, InputHeight));
|
||||||
int widgetHeight =
|
int widgetHeight =
|
||||||
std::min(MAX_TEXTINPUT_HEIGHT, std::max(height, conf::textInput::height));
|
std::min(MAX_TEXTINPUT_HEIGHT, std::max(height, contentHeight));
|
||||||
|
|
||||||
setFixedHeight(widgetHeight);
|
setFixedHeight(widgetHeight);
|
||||||
input_->setFixedHeight(textInputHeight);
|
input_->setFixedHeight(textInputHeight);
|
||||||
|
|
Loading…
Reference in a new issue