Commit 2869e857 authored by captainwong's avatar captainwong

jlibqt RndButton ok

parent 194f317c
#include "RndButton.h"
#include "../QtUtils.h"
#include "../QtStylesheet.h"
using namespace jlib::qt;
RndButton::RndButton(QWidget* parent)
: QWidget(parent)
{
......@@ -24,12 +23,6 @@ void RndButton::set_attr(QString txt, QSize sz, int font_size)
txt_->setText(txt);
setFixedSize(sz);
/*QPixmap pixmap;
LOAD_PIXMAP_EX(QString::fromLocal8Bit(":/Skin/Ӧÿ1.png"));
QSize pixSize = pixmap.size();
pixSize.scale(sz, Qt::KeepAspectRatio);
pixmap_ = pixmap.scaled(pixSize, Qt::KeepAspectRatio, Qt::SmoothTransformation);*/
txt_->resize(size());
txt_->move(0, 0);
txt_->show();
......@@ -51,7 +44,6 @@ void RndButton::paintEvent(QPaintEvent* e)
QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing, true);
QPainterPath path;
//int radius = std::min(rect().width() / 20, rect().height() / 20);
path.addRoundedRect(QRectF(0, 0, width(), height()), 10, 10);
QPen pen(Qt::black, 1);
painter.setPen(pen);
......
......@@ -5,15 +5,18 @@
//namespace HBVideoPlatform {
//namespace common {
#include <QtWidgets>
class RndButton : public QWidget
{
Q_OBJECT
public:
RndButton(QWidget *parent);
RndButton(QWidget* parent);
~RndButton();
void set_attr(QString txt, QSize btn_sz = { 60, 30 }, int font_size = 14);
void set_highlight(bool on = true);
protected:
......@@ -37,5 +40,6 @@ private:
bool is_highlighted_ = false;
};
//}
//}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment