mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-12-02 19:14:05 +00:00
a234bb0e43
* remove all qt-style * remove all related #translationLine #GroupCombox qt style
35 lines
868 B
C++
35 lines
868 B
C++
#include "utils.hh"
|
|
#include <QDir>
|
|
#include <QPalette>
|
|
#include <QStyle>
|
|
|
|
QString Utils::Path::combine(const QString& path1, const QString& path2)
|
|
{
|
|
return QDir::cleanPath(path1 + QDir::separator() + path2);
|
|
}
|
|
|
|
QString Utils::Url::getSchemeAndHost( QUrl const & url )
|
|
{
|
|
auto _url = url.url();
|
|
auto index = _url.indexOf("://");
|
|
auto hostEndIndex = _url.indexOf("/",index+3);
|
|
return _url.mid(0,hostEndIndex);
|
|
}
|
|
|
|
void Utils::Widget::setNoResultColor(QWidget * widget, bool noResult)
|
|
{
|
|
if( noResult ) {
|
|
QPalette pal( widget->palette() );
|
|
// #febb7d
|
|
QRgb rgb = 0xfebb7d;
|
|
pal.setColor( QPalette::Base, QColor( rgb ) );
|
|
widget->setAutoFillBackground( true );
|
|
widget->setPalette( pal );
|
|
}
|
|
else {
|
|
QPalette pal( widget->style()->standardPalette() );
|
|
widget->setAutoFillBackground( true );
|
|
widget->setPalette( pal );
|
|
}
|
|
}
|