add dynamic language change support
add "en" ts
This commit is contained in:
@@ -17,10 +17,10 @@ ColorButton::ColorButton(QWidget * parent): QPushButton(parent) {
|
||||
label->setFrameStyle(QFrame::Panel | QFrame::Sunken);
|
||||
label->show();
|
||||
pal = label->palette();
|
||||
menu.addAction(QIcon(":/icons/edit-copy.png"), tr("Copy"), this, SLOT(copy()));
|
||||
menu.addAction(QIcon(":/icons/edit-paste.png"), tr("Paste"), this, SLOT(paste()));
|
||||
a_copy = menu.addAction(QIcon(":/icons/edit-copy.png"), tr("Copy"), this, SLOT(copy()));
|
||||
a_paste = menu.addAction(QIcon(":/icons/edit-paste.png"), tr("Paste"), this, SLOT(paste()));
|
||||
menu.addSeparator();
|
||||
menu.addAction(tr("Mix with clipboard"), this, SLOT(mix()));
|
||||
a_mix = menu.addAction(tr("Mix with clipboard"), this, SLOT(mix()));
|
||||
setAcceptDrops(true);
|
||||
connect(this, SIGNAL(clicked(bool)), this, SLOT(clicked()));
|
||||
}
|
||||
@@ -86,6 +86,20 @@ void ColorButton::dropEvent(QDropEvent * e) {
|
||||
}
|
||||
|
||||
|
||||
void ColorButton::changeEvent(QEvent * e) {
|
||||
QPushButton::changeEvent(e);
|
||||
switch (e->type()) {
|
||||
case QEvent::LanguageChange:
|
||||
a_copy->setText(tr("Copy"));
|
||||
a_paste->setText(tr("Paste"));
|
||||
a_mix->setText(tr("Mix with clipboard"));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ColorButton::clicked() {
|
||||
QColor ret = QColorDialog::getColor(color(), this, tr("Choose color"), options);
|
||||
if (!ret.isValid()) return;
|
||||
|
||||
Reference in New Issue
Block a user