当前位置: 首页>>代码示例>>C++>>正文


C++ CFG::get_tmp_value方法代码示例

本文整理汇总了C++中CFG::get_tmp_value方法的典型用法代码示例。如果您正苦于以下问题:C++ CFG::get_tmp_value方法的具体用法?C++ CFG::get_tmp_value怎么用?C++ CFG::get_tmp_value使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CFG的用法示例。


在下文中一共展示了CFG::get_tmp_value方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: info


//.........这里部分代码省略.........
	usr.sa_flags = SA_RESTART;

	if (sigaction(SIGUSR1, &usr, 0) > 0) {
		cerr << "sigaction: " << strerror(errno) << endl;
		valid = false;
		return;
	}

	setup_keys(this);
	beamer = new BeamerWindow(this);
	setup_keys(beamer);

	splitter = new Splitter(this);
	toc = new Toc(this, splitter);

	canvas = new Canvas(this, splitter); // beamer must already exist
	if (!canvas->is_valid()) {
		valid = false;
		return;
	}
	res->connect_canvas();
	canvas->update_page_overlay(); // set initial position

	splitter->addWidget(toc);
	splitter->addWidget(canvas);
	splitter->setSizes(QList<int>() << (width() / 4) << (width() * 3 / 4)); // TODO config option

	toc->hide();

	// load config options
	CFG *config = CFG::get_instance();
	smooth_scroll_delta = config->get_value("Settings/smooth_scroll_delta").toInt();
	screen_scroll_factor = config->get_value("Settings/screen_scroll_factor").toFloat();

	layout = new QVBoxLayout();
	layout->setContentsMargins(0, 0, 0, 0);
	layout->setSpacing(0);

	// initialize info bar
	QIcon::setThemeName(CFG::get_instance()->get_value("Settings/icon_theme").toString());

	info_label_icon.setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
	info_password.setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
	info_widget.setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);

	info_label_text.setWordWrap(true);
	info_label_text.setTextFormat(Qt::PlainText);
	info_password.setEchoMode(QLineEdit::Password);

	info_layout.addWidget(&info_label_icon);
	info_layout.addWidget(&info_label_text);
	info_layout.addWidget(&info_password);
	info_widget.setLayout(&info_layout);

	layout->addWidget(&info_widget);
	connect(&info_password, SIGNAL(returnPressed()), this, SLOT(reload()),
			Qt::UniqueConnection);

	update_info_widget();

	presenter_progress.setMinimum(1);
 	presenter_progress.setMaximum(res->get_page_count());
 	presenter_progress.setValue(canvas->get_layout()->get_page() + 1);
//	presenter_progress.setFormat("%v/%m");
 	presenter_progress.setTextVisible(true);

	layout->addWidget(splitter);
	layout->addWidget(&presenter_progress);
	layout->addWidget(search_bar);
	setLayout(layout);

	QFileInfo info(res->get_file());
	setWindowTitle(QString::fromUtf8("%1 \u2014 katarakt").arg(info.fileName()));
	setMinimumSize(50, 50);
	resize(500, 500);

	search_bar->hide();
	info_password.setFocus(Qt::OtherFocusReason); // only works if shown

	// apply start options
	if (res->is_valid()) {
		canvas->get_layout()->scroll_page(config->get_tmp_value("start_page").toInt(), false);
	}
	if (CFG::get_instance()->get_tmp_value("fullscreen").toBool()) {
		toggle_fullscreen();
	}

	// enable transparency, but only in the right places
	setAttribute(Qt::WA_TranslucentBackground);
	presenter_progress.setAutoFillBackground(true);
	search_bar->setAutoFillBackground(true);
	info_widget.setAutoFillBackground(true);
	toc->setAutoFillBackground(true);
	// the splitter handle has to be opaque, canvas has to be transparent
	// problem: either both are transparent or none is
	// these functions don't help, the splitter handle is still transparent (depending on theme)
//	splitter->handle(0)->setAttribute(Qt::WA_TranslucentBackground, false);
//	splitter->handle(0)->setBackgroundRole(QPalette::Window);
//	splitter->handle(0)->setAutoFillBackground(true);
}
开发者ID:meisterT,项目名称:katarakt,代码行数:101,代码来源:viewer.cpp


注:本文中的CFG::get_tmp_value方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。