コード例 #1
0
FileSelectWidget::FileSelectWidget(QWidget *parent) : QWidget(parent), CommonMyWidgetWrapper(this)
{
	QFrame *frameTextAndButton = new QFrame;
	QHBoxLayout *layoutTextAndButton = new QHBoxLayout;
	QVBoxLayout *layout = new QVBoxLayout(this);
	layout->setContentsMargins(0, 0, 0, 0);
	layout->setSpacing(2);
	layoutTextAndButton->setContentsMargins(0, 0, 0, 0);
	layoutTextAndButton->setSpacing(2);
	lineEdit = new QLineEdit;
	button = new QPushButton;
	labelImage = new QLabel;
	labelImage->setAlignment(Qt::AlignTop | Qt::AlignHCenter);
	labelImage->setContentsMargins(0, 0, 0, 0);
	labelImage->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
	labelImage->setMaximumHeight(150);
	labelImage->setMaximumWidth(300);
	labelImage->setStyleSheet(
		"QLabel { color: red; font-weight: bold; border: 1px solid black;"
		"background-color: white; padding: 1px; }");
	QIcon iconFolder = QIcon::fromTheme("folder", QIcon(":/system/icons/folder.svg"));
	button->setIcon(iconFolder);
	layoutTextAndButton->addWidget(lineEdit);
	layoutTextAndButton->addWidget(button);
	frameTextAndButton->setLayout(layoutTextAndButton);

	layout->addWidget(frameTextAndButton);
	layout->addWidget(labelImage);

	defaultValue = "";
	connect(button, SIGNAL(clicked()), this, SLOT(slotSelectFile()));
	connect(lineEdit, SIGNAL(editingFinished()), this, SLOT(slotChangedFile()));
}
コード例 #2
0
KisFileNameRequester::KisFileNameRequester(QWidget *parent)
    : QWidget(parent)
    , m_ui(new Ui::WdgFileNameRequester)
    , m_mode(KoFileDialog::OpenFile)
{
    m_ui->setupUi(this);

    m_ui->btnSelectFile->setIcon(kisIcon("folder"));

    connect(m_ui->btnSelectFile, SIGNAL(clicked()), SLOT(slotSelectFile()));
    connect(m_ui->txtFileName, SIGNAL(textChanged(const QString&)), SIGNAL(textChanged(const QString&)));
}
コード例 #3
0
ファイル: coptions.cpp プロジェクト: radekp/qfreecell
COptions::COptions(QWidget *parent, const char *name, void *o)
: QDialog(parent){
	
	unsigned int i;
	char         buffer[100];
	
//	setCaption("Options");
	move(POS_X, POS_Y);
	initDialog();
	connect(QPushButton_CANCEL, SIGNAL(clicked()), this, SLOT(reject()));
	connect(QScrollBar_EMPTY, SIGNAL(valueChanged(int)), this, SLOT(newEmpty(int)));
	connect(QPushButton_OK, SIGNAL(clicked()), this, SLOT(ok()));
			
	connect(QRadioButton_COLOR, SIGNAL(clicked()), this, SLOT(slotRadioColor()));
	connect(QRadioButton_FILE, SIGNAL(clicked()), this, SLOT(slotRadioFile()));
	//connect(QPushButton_SELECTCOLOR, SIGNAL(clicked()), this, SLOT(slotSelectColor()));
	connect(QPushButton_SELECTFILE, SIGNAL(clicked()), this, SLOT(slotSelectFile()));
	
	memcpy(&opt, (struct options*)o, sizeof(opt));

	parent_class = (Freecell*)parent;

	QSpinBox_NUMFREECELLS->setValue(*opt.num_freecells);
	QSpinBox_NUMFREECELLS->setRange(*opt.spinbox_freecells_min, 4);
	
	if(*opt.background_enabled)
	{
		QRadioButton_FILE->setChecked(true);
		QRadioButton_COLOR->setChecked(false);
		QLineEdit_BACKGROUND->setText(opt.background_file);
	}
	else
	{
		QRadioButton_FILE->setChecked(false);
		QRadioButton_COLOR->setChecked(true);
	}

//	QWidget_COLORWIDGET->setBackgroundColor(*opt.background_color);
	QLineEdit_BACKGROUND->setText(opt.background_file);
	
	// read card layouts for cells
	sprintf(buffer, "%s/freecells", ((Freecell*)parent)->directory);
	dir.setPath(buffer);
        dir.setNameFilters(QStringList() << "*.bmp");
		
	selected = 0;
	
	if(dir.count()-1>0)
		QScrollBar_EMPTY->setRange(0, dir.count()-1);
	else QScrollBar_EMPTY->setRange(0, 0);
	QScrollBar_EMPTY->setValue(selected);
}