update
This commit is contained in:
@@ -25,6 +25,14 @@ QPushButton* makeAlgoButton(const QString& title, QWidget* parent) {
|
||||
|
||||
} // namespace
|
||||
|
||||
QString BlackholeResolveDialog::defaultModelInpaintPrompt() {
|
||||
return QStringLiteral(
|
||||
"中国画局部,需去除人物并只补背景:请严格依据掩膜外已见的笔墨皴擦、设色层次、留白与纸绢肌理,"
|
||||
"在掩膜内自然延展,补全为山石、坡岸、云水、苔点或空灵留白等,与外缘笔法、墨色与气韵连贯衔接;"
|
||||
"禁止出现人物轮廓、肢体、衣褶、五官、手足、发丝、肤色、投影及去人后的模糊晕带、鬼影边缘与色块台阶,"
|
||||
"整体须像原画从未画入人物一样自然,不留修补感。");
|
||||
}
|
||||
|
||||
BlackholeResolveDialog::BlackholeResolveDialog(const QString& blackholeName, QWidget* parent)
|
||||
: QDialog(parent),
|
||||
m_blackholeName(blackholeName) {
|
||||
@@ -134,7 +142,8 @@ void BlackholeResolveDialog::buildDetailPage() {
|
||||
pLay->setSpacing(8);
|
||||
|
||||
m_promptEdit = new QPlainTextEdit(panel);
|
||||
m_promptEdit->setPlaceholderText(QStringLiteral("提示词(可选)"));
|
||||
m_promptEdit->setPlainText(BlackholeResolveDialog::defaultModelInpaintPrompt());
|
||||
m_promptEdit->setPlaceholderText(QStringLiteral("可按画面增删;若全部删空,请求时仍使用内置默认描述"));
|
||||
m_promptEdit->setMinimumHeight(72);
|
||||
pLay->addWidget(m_promptEdit);
|
||||
|
||||
|
||||
@@ -19,6 +19,9 @@ public:
|
||||
Algorithm selectedAlgorithm() const { return m_selectedAlgorithm; }
|
||||
QString promptText() const;
|
||||
|
||||
/// 模型补全(LaMa 等)内置正向提示:中国画去人物、补背景纹理,无人物残留。
|
||||
[[nodiscard]] static QString defaultModelInpaintPrompt();
|
||||
|
||||
private:
|
||||
void buildSelectPage();
|
||||
void buildDetailPage();
|
||||
|
||||
@@ -20,7 +20,7 @@ static QLabel* makeImageLabel(QWidget* parent) {
|
||||
static QScrollArea* wrapScroll(QWidget* child, QWidget* parent) {
|
||||
auto* sc = new QScrollArea(parent);
|
||||
sc->setWidget(child);
|
||||
sc->setWidgetResizable(true);
|
||||
sc->setWidgetResizable(false);
|
||||
sc->setBackgroundRole(QPalette::Dark);
|
||||
return sc;
|
||||
}
|
||||
@@ -28,7 +28,7 @@ static QScrollArea* wrapScroll(QWidget* child, QWidget* parent) {
|
||||
InpaintPreviewDialog::InpaintPreviewDialog(const QString& title, QWidget* parent)
|
||||
: QDialog(parent) {
|
||||
setModal(true);
|
||||
setMinimumSize(720, 480);
|
||||
setMinimumSize(880, 520);
|
||||
setWindowTitle(title);
|
||||
|
||||
auto* root = new QVBoxLayout(this);
|
||||
@@ -39,6 +39,8 @@ InpaintPreviewDialog::InpaintPreviewDialog(const QString& title, QWidget* parent
|
||||
m_afterLabel = makeImageLabel(this);
|
||||
m_beforeScroll = wrapScroll(m_beforeLabel, this);
|
||||
m_afterScroll = wrapScroll(m_afterLabel, this);
|
||||
m_beforeScroll->setMinimumHeight(200);
|
||||
m_afterScroll->setMinimumHeight(200);
|
||||
|
||||
auto* splitter = new QSplitter(Qt::Horizontal, this);
|
||||
splitter->addWidget(m_beforeScroll);
|
||||
@@ -57,12 +59,16 @@ InpaintPreviewDialog::InpaintPreviewDialog(const QString& title, QWidget* parent
|
||||
|
||||
void InpaintPreviewDialog::setImages(const QImage& before, const QImage& after) {
|
||||
if (m_beforeLabel) {
|
||||
m_beforeLabel->setPixmap(QPixmap::fromImage(before));
|
||||
m_beforeLabel->adjustSize();
|
||||
const QPixmap pb = QPixmap::fromImage(before);
|
||||
m_beforeLabel->setPixmap(pb);
|
||||
m_beforeLabel->setMinimumSize(pb.size());
|
||||
m_beforeLabel->resize(pb.size());
|
||||
}
|
||||
if (m_afterLabel) {
|
||||
m_afterLabel->setPixmap(QPixmap::fromImage(after));
|
||||
m_afterLabel->adjustSize();
|
||||
const QPixmap pa = QPixmap::fromImage(after);
|
||||
m_afterLabel->setPixmap(pa);
|
||||
m_afterLabel->setMinimumSize(pa.size());
|
||||
m_afterLabel->resize(pa.size());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user