diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 6bae7787..731d059e 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -327,10 +327,11 @@ void MainWindow::createTopWifiUI() lbTopWifiList->show(); /*新建有线网按钮*/ btnAddNet = new QPushButton(topWifiListWidget); - btnAddNet->resize(W_BTN_FUN, H_BTN_FUN); btnAddNet->move(X_BTN_FUN, Y_BTN_FUN); btnAddNet->setText(tr("Hide WLAN"));//"加入网络" btnAddNet->setStyleSheet(funcBtnQss); + int textWith = QFontMetrics(btnAddNet->font()).width(btnAddNet->text()); + btnAddNet->resize(textWith > W_BTN_FUN ? textWith : W_BTN_FUN, H_BTN_FUN); btnAddNet->setFocusPolicy(Qt::NoFocus); btnAddNet->show(); connect(btnAddNet,SIGNAL(clicked()),this,SLOT(onBtnAddNetClicked()));