void SaleDialog::initFindCustomerButton() {
QString imagePath = QString("%1/find.png").arg(Configs::getInstance().getImagesFolderFilePath());
QPixmap pixmap(imagePath);
QIcon icon(imagePath);
findCustomerButton = new QPushButton(icon, "");
QSize size = QSize(pixmap.size().width() + 6, pixmap.size().height() + 4);
findCustomerButton->setMinimumSize(size);
findCustomerButton->setMaximumSize(size); // 設(shè)置按鈕的大小為圖片的大小
findCustomerButton->setFocusPolicy(Qt::NoFocus); // 得到焦點(diǎn)時(shí),不顯示虛線框
findCustomerButton->setFlat(true);
findCustomerButton->setDefault(true);
findCustomerButton->setToolTip(tr("查找客戶"));
QHBoxLayout *buttonLayout = new QHBoxLayout();
buttonLayout->setContentsMargins(0, 0, 0, 0);
buttonLayout->addStretch();
buttonLayout->addWidget(findCustomerButton);
ui->cardNumberLineEdit->setLayout(buttonLayout);
// 設(shè)置輸入框中文件輸入?yún)^(qū),不讓輸入的文字在被隱藏在按鈕下
ui->cardNumberLineEdit->setTextMargins(0, 1, pixmap.size().width(), 1);
connect(findCustomerButton, SIGNAL(clicked()), this, SLOT(findCustomer()));
}