本文整理汇总了C++中pix函数的典型用法代码示例。如果您正苦于以下问题:C++ pix函数的具体用法?C++ pix怎么用?C++ pix使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pix函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CV_Assert
void cv::cuda::meanShiftSegmentation(InputArray _src, OutputArray _dst, int sp, int sr, int minsize, TermCriteria criteria)
{
GpuMat src = _src.getGpuMat();
CV_Assert( src.type() == CV_8UC4 );
const int nrows = src.rows;
const int ncols = src.cols;
const int hr = sr;
const int hsp = sp;
// Perform mean shift procedure and obtain region and spatial maps
GpuMat d_rmap, d_spmap;
cuda::meanShiftProc(src, d_rmap, d_spmap, sp, sr, criteria);
Mat rmap(d_rmap);
Mat spmap(d_spmap);
Graph<SegmLinkVal> g(nrows * ncols, 4 * (nrows - 1) * (ncols - 1)
+ (nrows - 1) + (ncols - 1));
// Make region adjacent graph from image
Vec4b r1;
Vec4b r2[4];
Vec2s sp1;
Vec2s sp2[4];
int dr[4];
int dsp[4];
for (int y = 0; y < nrows - 1; ++y)
{
Vec4b* ry = rmap.ptr<Vec4b>(y);
Vec4b* ryp = rmap.ptr<Vec4b>(y + 1);
Vec2s* spy = spmap.ptr<Vec2s>(y);
Vec2s* spyp = spmap.ptr<Vec2s>(y + 1);
for (int x = 0; x < ncols - 1; ++x)
{
r1 = ry[x];
sp1 = spy[x];
r2[0] = ry[x + 1];
r2[1] = ryp[x];
r2[2] = ryp[x + 1];
r2[3] = ryp[x];
sp2[0] = spy[x + 1];
sp2[1] = spyp[x];
sp2[2] = spyp[x + 1];
sp2[3] = spyp[x];
dr[0] = dist2(r1, r2[0]);
dr[1] = dist2(r1, r2[1]);
dr[2] = dist2(r1, r2[2]);
dsp[0] = dist2(sp1, sp2[0]);
dsp[1] = dist2(sp1, sp2[1]);
dsp[2] = dist2(sp1, sp2[2]);
r1 = ry[x + 1];
sp1 = spy[x + 1];
dr[3] = dist2(r1, r2[3]);
dsp[3] = dist2(sp1, sp2[3]);
g.addEdge(pix(y, x, ncols), pix(y, x + 1, ncols), SegmLinkVal(dr[0], dsp[0]));
g.addEdge(pix(y, x, ncols), pix(y + 1, x, ncols), SegmLinkVal(dr[1], dsp[1]));
g.addEdge(pix(y, x, ncols), pix(y + 1, x + 1, ncols), SegmLinkVal(dr[2], dsp[2]));
g.addEdge(pix(y, x + 1, ncols), pix(y + 1, x, ncols), SegmLinkVal(dr[3], dsp[3]));
}
}
for (int y = 0; y < nrows - 1; ++y)
{
r1 = rmap.at<Vec4b>(y, ncols - 1);
r2[0] = rmap.at<Vec4b>(y + 1, ncols - 1);
sp1 = spmap.at<Vec2s>(y, ncols - 1);
sp2[0] = spmap.at<Vec2s>(y + 1, ncols - 1);
dr[0] = dist2(r1, r2[0]);
dsp[0] = dist2(sp1, sp2[0]);
g.addEdge(pix(y, ncols - 1, ncols), pix(y + 1, ncols - 1, ncols), SegmLinkVal(dr[0], dsp[0]));
}
for (int x = 0; x < ncols - 1; ++x)
{
r1 = rmap.at<Vec4b>(nrows - 1, x);
r2[0] = rmap.at<Vec4b>(nrows - 1, x + 1);
sp1 = spmap.at<Vec2s>(nrows - 1, x);
sp2[0] = spmap.at<Vec2s>(nrows - 1, x + 1);
dr[0] = dist2(r1, r2[0]);
dsp[0] = dist2(sp1, sp2[0]);
g.addEdge(pix(nrows - 1, x, ncols), pix(nrows - 1, x + 1, ncols), SegmLinkVal(dr[0], dsp[0]));
}
DjSets comps(g.numv);
// Find adjacent components
for (int v = 0; v < g.numv; ++v)
{
for (int e_it = g.start[v]; e_it != -1; e_it = g.edges[e_it].next)
{
int c1 = comps.find(v);
int c2 = comps.find(g.edges[e_it].to);
if (c1 != c2 && g.edges[e_it].val.dr < hr && g.edges[e_it].val.dsp < hsp)
comps.merge(c1, c2);
}
//.........这里部分代码省略.........
示例2: total_size
void Data_analysis_gui::save_as_image( const QString& filename,
const QString& format,
bool show_stats, bool show_grid ) {
// get a file name and the name of the filter to use to save the image.
// 3 filters are available: PNG, BMP, and Postscript. Postscript is not
// available on Windows (Qt limitation).
// Create a blank image of the correct dimensions
int extra_width = 15;
int min_height = 0;
if( show_stats ) {
extra_width = 200;
min_height = 250;
}
QSize total_size( plot_->size().width() + extra_width,
std::max( min_height, plot_->size().height()+10 ) );
QPixmap pix( total_size );
pix.fill();
QPainter painter( &pix );
// draw the content of the plot
QwtPlotPrintFilter filter;
if( show_grid )
filter.setOptions( QwtPlotPrintFilter::PrintTitle | QwtPlotPrintFilter::PrintGrid );
else
filter.setOptions( QwtPlotPrintFilter::PrintTitle );
QRect rect = plot_->rect();
rect.setY( rect.y() + 10 );
plot_->print( &painter, rect, filter );
// Add the summary statistics to the image if requested
if( show_stats ) {
QFont font = plot_->axisFont( QwtPlot::xBottom );
painter.setFont( font );
int text_y_start = std::max( 40, total_size.height()/2 - 100 );
painter.translate( plot_->size().width()+15 , text_y_start );
paint_stats( painter );
}
// Finally, save the pixmap in the required format
if( format == "Postscript" || format == "PS" ) {
/*
#if defined(WIN32) || defined(_WIN32)
if (show_stats)
build_stats();
SimplePs ps(filename,plot_, _stats,show_stats);
if (!ps.isopen()){
QMessageBox::warning(this,"Unable to save file",
"Failed to save ps file",QMessageBox::Ok,
Qt::NoButton);
return;
}
savePostScript(ps);
#else
*/
QPrinter printer;
printer.setOutputFormat(QPrinter::PostScriptFormat);
printer.setOutputFileName( filename );
printer.setPageSize( QPrinter::A6 );
printer.setFullPage( true );
printer.setOrientation( QPrinter::Landscape );
plot_->print(printer, filter);
QPainter P(&printer);
//P.begin(&printer);
//paint_stats(P);
P.drawPixmap(QPoint(0,0),pix);
//#endif
}
else {
QByteArray tmp = format.toLatin1();
pix.save( filename, tmp.constData() );
}
}
示例3: pix
int MusicUserRecordWidget::exec()
{
QPixmap pix(M_BG_MANAGER->getMBackground());
ui->background->setPixmap(pix.scaled( size() ));
return MusicAbstractMoveDialog::exec();;
}
示例4: blurfilter_y
void* blurfilter_y(void* t_param){
struct thread_data_blurfilter* thread_data = (thread_data_blurfilter*)t_param;
const int xsize = thread_data->xsize;
const int ysize = thread_data->ysize;
pixel* src = thread_data->src;
pixel* dst = thread_data->dst;
const int radius = thread_data->radius;
const double* w = thread_data->w;
const int y_start = thread_data->y_start;
const int y_end = thread_data->y_end;
int x,y,y2, wi;
double r,g,b,n, wc;
for (y=y_start; y<y_end; y++) {
for (x=0; x<xsize; x++) {
r = w[0] * pix(dst, x, y, xsize)->r;
g = w[0] * pix(dst, x, y, xsize)->g;
b = w[0] * pix(dst, x, y, xsize)->b;
n = w[0];
for ( wi=1; wi <= radius; wi++) {
wc = w[wi];
y2 = y - wi;
if(y2 >= 0) {
r += wc * pix(dst, x, y2, xsize)->r;
g += wc * pix(dst, x, y2, xsize)->g;
b += wc * pix(dst, x, y2, xsize)->b;
n += wc;
}
y2 = y + wi;
if(y2 < ysize) {
r += wc * pix(dst, x, y2, xsize)->r;
g += wc * pix(dst, x, y2, xsize)->g;
b += wc * pix(dst, x, y2, xsize)->b;
n += wc;
}
}
pix(src,x,y, xsize)->r = r/n;
pix(src,x,y, xsize)->g = g/n;
pix(src,x,y, xsize)->b = b/n;
}
}
//for(y=y_start; y<y_end; y++)
// printf("%d", pix(src, xsize-1, y, xsize)->r);
pthread_exit(0);
}
示例5: whileBlocking
/** Loads the settings for this page */
void
ChatPage::load()
{
Settings->beginGroup(QString("Chat"));
whileBlocking(ui.checkBox_emoteprivchat)->setChecked(Settings->value("Emoteicons_PrivatChat", true).toBool());
whileBlocking(ui.checkBox_emotegroupchat)->setChecked(Settings->value("Emoteicons_GroupChat", true).toBool());
whileBlocking(ui.checkBox_enableCustomFonts)->setChecked(Settings->value("EnableCustomFonts", true).toBool());
whileBlocking(ui.checkBox_enableCustomFontSize)->setChecked(Settings->value("EnableCustomFontSize", true).toBool());
whileBlocking(ui.minimumFontSize)->setValue(Settings->value("MinimumFontSize", 10).toInt());
whileBlocking(ui.checkBox_enableBold)->setChecked(Settings->value("EnableBold", true).toBool());
whileBlocking(ui.checkBox_enableItalics)->setChecked(Settings->value("EnableItalics", true).toBool());
whileBlocking(ui.minimumContrast)->setValue(Settings->value("MinimumContrast", 4.5).toDouble());
Settings->endGroup();
// state of distant Chat combobox
int index = Settings->value("DistantChat", 0).toInt();
whileBlocking(ui.distantChatComboBox)->setCurrentIndex(index);
fontTempChat.fromString(Settings->getChatScreenFont());
whileBlocking(ui.sendMessageWithCtrlReturn)->setChecked(Settings->getChatSendMessageWithCtrlReturn());
whileBlocking(ui.sendAsPlainTextByDef)->setChecked(Settings->getChatSendAsPlainTextByDef());
whileBlocking(ui.loadEmbeddedImages)->setChecked(Settings->getChatLoadEmbeddedImages());
whileBlocking(ui.DontSendTyping)->setChecked(Settings->getChatDoNotSendIsTyping());
std::string advsetting;
if(rsConfig->getConfigurationOption(RS_CONFIG_ADVANCED, advsetting) && (advsetting == "YES"))
{ }
else
ui.DontSendTyping->hide();
whileBlocking(ui.sbSearch_CharToStart)->setValue(Settings->getChatSearchCharToStartSearch());
whileBlocking(ui.cbSearch_CaseSensitively)->setChecked(Settings->getChatSearchCaseSensitively());
whileBlocking(ui.cbSearch_WholeWords)->setChecked(Settings->getChatSearchWholeWords());
whileBlocking(ui.cbSearch_MoveToCursor)->setChecked(Settings->getChatSearchMoveToCursor());
whileBlocking(ui.cbSearch_WithoutLimit)->setChecked(Settings->getChatSearchSearchWithoutLimit());
whileBlocking(ui.sbSearch_MaxLimitColor)->setValue(Settings->getChatSearchMaxSearchLimitColor());
rgbChatSearchFoundColor=Settings->getChatSearchFoundColor();
QPixmap pix(24, 24);
pix.fill(rgbChatSearchFoundColor);
ui.btSearch_FoundColor->setIcon(pix);
whileBlocking(ui.publicChatLoadCount)->setValue(Settings->getPublicChatHistoryCount());
whileBlocking(ui.privateChatLoadCount)->setValue(Settings->getPrivateChatHistoryCount());
whileBlocking(ui.lobbyChatLoadCount)->setValue(Settings->getLobbyChatHistoryCount());
whileBlocking(ui.publicChatEnable)->setChecked(rsHistory->getEnable(RS_HISTORY_TYPE_PUBLIC));
whileBlocking(ui.privateChatEnable)->setChecked(rsHistory->getEnable(RS_HISTORY_TYPE_PRIVATE));
whileBlocking(ui.lobbyChatEnable)->setChecked(rsHistory->getEnable(RS_HISTORY_TYPE_LOBBY));
whileBlocking(ui.publicChatSaveCount)->setValue(rsHistory->getSaveCount(RS_HISTORY_TYPE_PUBLIC));
whileBlocking(ui.privateChatSaveCount)->setValue(rsHistory->getSaveCount(RS_HISTORY_TYPE_PRIVATE));
whileBlocking(ui.lobbyChatSaveCount)->setValue(rsHistory->getSaveCount(RS_HISTORY_TYPE_LOBBY));
// using fontTempChat.rawname() does not always work!
// see http://doc.qt.digia.com/qt-maemo/qfont.html#rawName
QStringList fontname = fontTempChat.toString().split(",");
whileBlocking(ui.labelChatFontPreview)->setText(fontname[0]);
whileBlocking(ui.labelChatFontPreview)->setFont(fontTempChat);
whileBlocking(ui.max_storage_period)->setValue(rsHistory->getMaxStorageDuration()/86400) ;
/* Load styles */
publicStylePath = loadStyleInfo(ChatStyle::TYPE_PUBLIC, ui.publicStyle, ui.publicComboBoxVariant, publicStyleVariant);
privateStylePath = loadStyleInfo(ChatStyle::TYPE_PRIVATE, ui.privateStyle, ui.privateComboBoxVariant, privateStyleVariant);
historyStylePath = loadStyleInfo(ChatStyle::TYPE_HISTORY, ui.historyStyle, ui.historyComboBoxVariant, historyStyleVariant);
RsGxsId gxs_id ;
rsMsgs->getDefaultIdentityForChatLobby(gxs_id) ;
ui.chatLobbyIdentity_IC->setFlags(IDCHOOSER_ID_REQUIRED) ;
if(!gxs_id.isNull())
ui.chatLobbyIdentity_IC->setChosenId(gxs_id);
uint chatflags = Settings->getChatFlags();
whileBlocking(ui.chat_NewWindow)->setChecked(chatflags & RS_CHAT_OPEN);
whileBlocking(ui.chat_Focus)->setChecked(chatflags & RS_CHAT_FOCUS);
whileBlocking(ui.chat_tabbedWindow)->setChecked(chatflags & RS_CHAT_TABBED_WINDOW);
whileBlocking(ui.chat_Blink)->setChecked(chatflags & RS_CHAT_BLINK);
uint chatLobbyFlags = Settings->getChatLobbyFlags();
whileBlocking(ui.chatLobby_Blink)->setChecked(chatLobbyFlags & RS_CHATLOBBY_BLINK);
// load personal invites
//
#ifdef TO_BE_DONE
for(;;)
{
QListWidgetItem *item = new QListWidgetItem;
item->setData(Qt::DisplayRole,tr("Private chat invite from")+" "+QString::fromUtf8(detail.name.c_str())) ;
QString tt ;
tt += tr("Name :")+" " + QString::fromUtf8(detail.name.c_str()) ;
tt += "\n" + tr("PGP id :")+" " + QString::fromStdString(invites[i].destination_pgp_id.toStdString()) ;
tt += "\n" + tr("Valid until :")+" " + QDateTime::fromTime_t(invites[i].time_of_validity).toString() ;
//.........这里部分代码省略.........
示例6: QFontMetricsF
//.........这里部分代码省略.........
_painter->setPen(pen) ;
QRect info_pos( X-5,Y-line_height-2, text_width + 10, line_height + 5) ;
//_painter->fillRect(info_pos,brush) ;
//_painter->drawRect(info_pos) ;
_painter->drawLine(QPointF(X,Y+3),QPointF(X+text_width,Y+3)) ;
_painter->drawLine(QPointF(X+text_width/2, Y+3), QPointF(X+text_width/2,S*fMATRIX_START_Y+peer_ids.size()*S*fROW_SIZE - S*fROW_SIZE+5)) ;
pen.setBrush(Qt::black) ;
_painter->setPen(pen) ;
_painter->drawText(QPointF(X,Y),name);
}
// Now draw the global switches.
peer_ids.clear() ;
for(std::list<RsPeerId>::const_iterator it(ssllist.begin());it!=ssllist.end();++it)
peer_ids.push_back(*it) ;
service_ids.clear() ;
for(std::map<uint32_t, RsServiceInfo>::const_iterator sit(ownServices.mServiceList.begin());sit!=ownServices.mServiceList.end();++sit)
service_ids.push_back(sit->first) ;
static const std::string global_switch[2] = { ":/icons/global_switch_off_128.png",
":/icons/global_switch_on_128.png" } ;
for(uint32_t i=0;i<service_ids.size();++i)
{
RsServicePermissions serv_perm ;
rsServiceControl->getServicePermissions(service_ids[i],serv_perm) ;
QPixmap pix(global_switch[serv_perm.mDefaultAllowed].c_str()) ;
QRect position = computeNodePosition(0,i,false) ;
position.setY(position.y() - S*fICON_SIZE_Y + 8/14.0*S) ;
position.setX(position.x() + 3/14.0*S) ;
position.setHeight(30/14.0*S) ;
position.setWidth(30/14.0*S) ;
_painter->drawPixmap(position,pix.scaledToHeight(S*fICON_SIZE_Y*0.9,Qt::SmoothTransformation),QRect(0,0,S*fICON_SIZE_X,S*fICON_SIZE_Y)) ;
}
// We draw for each service.
static const std::string pixmap_names[4] = { ":/icons/switch00_128.png",
":/icons/switch01_128.png",
":/icons/switch10_128.png",
":/icons/switch11_128.png" } ;
int n_col = 0 ;
int n_col_selected = -1 ;
int n_row_selected = -1 ;
for(std::map<uint32_t, RsServiceInfo>::const_iterator sit(ownServices.mServiceList.begin());sit!=ownServices.mServiceList.end();++sit,++n_col)
{
RsServicePermissions service_perms ;
rsServiceControl->getServicePermissions(sit->first,service_perms) ;
// draw the default switch.
// draw one switch per friend.
示例7: MeasureSingleShear
void MeasureSingleShear(
const std::vector<PixelList>& allpix,
const std::vector<BVec>& psf,
int& galorder, const ConfigFile& params,
ShearLog& log, BVec& shapelet,
std::complex<double>& gamma, DSmallMatrix22& cov,
double& nu, long& flag)
{
double gal_aperture = params.read("shear_aperture",3.);
double max_aperture = params.read("shear_max_aperture",0.);
// Initial value, but also returned with actual final value.
int galorder_init = params.read("shear_gal_order",6);
galorder = galorder_init;
int galorder2 = params.read("shear_gal_order2",20);
int maxm = params.read("shear_maxm",galorder);
int min_galorder = params.read("shear_min_gal_order",4);
double min_fpsf = params.read("shear_f_psf",1.);
double max_fpsf = params.read("shear_max_f_psf",min_fpsf);
double min_galsize = params.read("shear_min_gal_size",0.);
bool fixcen = params.read("shear_fix_centroid",false);
bool fixsigma = params.keyExists("shear_force_sigma");
double fixsigma_value = params.read("shear_force_sigma",0.);
bool use_fake_pixels = params.read("shear_use_fake_pixels",false);
double shear_inner_fake_aperture = params.read("shear_inner_fake_aperture",gal_aperture);
double shear_outer_fake_aperture = params.read("shear_outer_fake_aperture",1.e100);
double inner_fake_ap = 0.;
double outer_fake_ap = 0.;
try {
dbg<<"Start MeasureSingleShear\n";
dbg<<"allpix.size = "<<allpix.size()<<std::endl;
const int nexp = allpix.size();
for(int i=0;i<nexp;++i)
dbg<<"allpix["<<i<<"].size = "<<allpix[i].size()<<std::endl;
dbg<<"psf.size = "<<psf.size()<<std::endl;
Assert(psf.size() == allpix.size());
// Find harmonic mean of psf sizes:
// MJ: Is it better to use the harmonic mean of sigma or sigma^2?
// (Or something else entirely?)
double sigma_p = 0.;
const int npsf = psf.size();
Assert(npsf > 0);
for(int i=0;i<npsf;++i) {
sigma_p += 1./psf[i].getSigma();
dbg<<"psf["<<i<<"] sigma = "<<psf[i].getSigma()<<std::endl;
}
sigma_p = double(npsf) / sigma_p;
dbg<<"Harmonic mean = "<<sigma_p<<std::endl;
long flag1=0;
std::complex<double> cen_offset = 0.;
//
// Define initial sigma and aperture.
// We start with a native fit using sigma = 2*sigma_p:
// Or if we are fixed, then sigma_obs^2 = sigma_p^2 + sigma^2
//
double sigma = fixsigma_value;
double sigpsq = pow(sigma_p,2);
double sigma_obs =
fixsigma ?
sqrt(sigpsq + sigma*sigma) :
2.*sigma_p;
double galap = gal_aperture * sigma_obs;
dbg<<"galap = "<<gal_aperture<<" * "<<sigma_obs<<" = "<<galap<<std::endl;
if (max_aperture > 0. && galap > max_aperture) {
galap = max_aperture;
dbg<<" => "<<galap<<std::endl;
}
dbg<<"sigma_obs = "<<sigma_obs<<", sigma_p = "<<sigma_p<<std::endl;
//
// Load pixels from main PixelLists.
//
std::vector<PixelList> pix(nexp);
int npix = 0;
for(int i=0;i<nexp;++i) {
if (use_fake_pixels) {
inner_fake_ap = shear_inner_fake_aperture * sigma_obs;
outer_fake_ap = shear_outer_fake_aperture * sigma_obs;
}
GetSubPixList(pix[i],allpix[i],cen_offset,0.,galap,
inner_fake_ap,outer_fake_ap,params,flag1);
npix += pix[i].size();
}
dbg<<"npix = "<<npix<<std::endl;
if (npix < 10) {
dbg<<"Too few pixels to continue: "<<npix<<std::endl;
dbg<<"FLAG LT10PIX\n";
flag |= LT10PIX;
dbg<<"FLAG SHAPELET_NOT_DECONV\n";
flag |= SHAPELET_NOT_DECONV;
return;
}
//
// Do a crude measurement based on simple pixel sums.
// TODO: If we have single-epoch measurements, use those for the
// starting guess rather than crudeMeasure.
//
//.........这里部分代码省略.........
示例8: QVBoxLayout
QVBoxLayout* ColormapEditWidget::createButtonPanel()
{
QVBoxLayout* vLayout = new QVBoxLayout();
QHBoxLayout* hLayout = new QHBoxLayout();
m_cLabel = new QLabel( this );
m_sliders.clear();
QImage* image;
image = createImage( this->width() - 20 );
QPixmap pix( this->width() - 20, 20 );
pix.convertFromImage( *image );
m_cLabel->setPixmap( pix );
hLayout->addStretch();
hLayout->addWidget( m_cLabel );
hLayout->addStretch();
vLayout->addLayout( hLayout );
vLayout->addSpacing( 5 );
int i = 0;
{
QHBoxLayout* hLayout2 = new QHBoxLayout();
PushButtonWithId* insertButton = new PushButtonWithId( "+", i );
insertButton->setStyleSheet( "QPushButton { font: bold 12px; max-width: 14px; max-height: 14px; } ");
connect( insertButton, SIGNAL( signalClicked( int ) ), this, SLOT( newEntry( int ) ) );
insertButton->setDisabled( true );
PushButtonWithId* deleteButton = new PushButtonWithId( "-", i );
deleteButton->setStyleSheet( "QPushButton { font: bold 12px; max-width: 14px; max-height: 14px; } ");
connect( deleteButton, SIGNAL( signalClicked( int ) ), this, SLOT( removeEntry( int ) ) );
deleteButton->setDisabled( true );
PushButtonWithId* upButton = new PushButtonWithId( "^", i );
upButton->setStyleSheet( "QPushButton { font: bold 12px; max-width: 14px; max-height: 14px; } ");
upButton->setDisabled( true );
//connect( upButton, SIGNAL( signalClicked( int ) ), this, SLOT( moveUp( int ) ) );
PushButtonWithId* downButton = new PushButtonWithId( "v", i );
downButton->setStyleSheet( "QPushButton { font: bold 12px; max-width: 14px; max-height: 14px; } ");
connect( downButton, SIGNAL( signalClicked( int ) ), this, SLOT( moveDown( int ) ) );
SliderWithEdit* slider = new SliderWithEdit( tr(""), Fn::Position::EAST, i );
m_sliders.push_back( slider );
slider->setMin( 0.0f );
slider->setMax( m_colormap.get( i + 1 ).value );
slider->setValue( m_colormap.get( i ).value );
connect( slider, SIGNAL( valueChanged( float, int ) ), this, SLOT( sliderChanged( float, int ) ) );
ColorWidgetWithLabel* colorWidget = new ColorWidgetWithLabel( QString::number( i ), i );
colorWidget->setValue( m_colormap.get( i ).color );
connect( colorWidget, SIGNAL( colorChanged( QColor, int ) ), this, SLOT( colorChanged( QColor, int ) ) );
hLayout2->addWidget( insertButton );
hLayout2->addWidget( deleteButton );
hLayout2->addWidget( upButton );
hLayout2->addWidget( downButton );
hLayout2->addWidget( slider );
hLayout2->addWidget( colorWidget );
vLayout->addLayout( hLayout2 );
}
for ( int i = 1; i < m_colormap.size() - 1; ++i )
{
QHBoxLayout* hLayout4 = new QHBoxLayout();
PushButtonWithId* insertButton = new PushButtonWithId( "+", i );
hLayout4->addWidget( insertButton );
insertButton->setStyleSheet( "QPushButton { font: bold 12px; max-width: 14px; max-height: 14px; } ");
connect( insertButton, SIGNAL( signalClicked( int ) ), this, SLOT( newEntry( int ) ) );
PushButtonWithId* deleteButton = new PushButtonWithId( "-", i );
hLayout4->addWidget( deleteButton );
deleteButton->setStyleSheet( "QPushButton { font: bold 12px; max-width: 14px; max-height: 14px; } ");
connect( deleteButton, SIGNAL( signalClicked( int ) ), this, SLOT( removeEntry( int ) ) );
PushButtonWithId* upButton = new PushButtonWithId( "^", i );
hLayout4->addWidget( upButton );
upButton->setStyleSheet( "QPushButton { font: bold 12px; max-width: 14px; max-height: 14px; } ");
connect( upButton, SIGNAL( signalClicked( int ) ), this, SLOT( moveUp( int ) ) );
PushButtonWithId* downButton = new PushButtonWithId( "v", i );
hLayout4->addWidget( downButton );
downButton->setStyleSheet( "QPushButton { font: bold 12px; max-width: 14px; max-height: 14px; } ");
connect( downButton, SIGNAL( signalClicked( int ) ), this, SLOT( moveDown( int ) ) );
SliderWithEdit* slider = new SliderWithEdit( tr(""), Fn::Position::EAST, i );
m_sliders.push_back( slider );
slider->setMin( m_colormap.get( i - 1 ).value );
slider->setMax( m_colormap.get( i + 1 ).value );
slider->setValue( m_colormap.get( i ).value );
connect( slider, SIGNAL( valueChanged( float, int ) ), this, SLOT( sliderChanged( float, int ) ) );
hLayout4->addWidget( slider );
ColorWidgetWithLabel* colorWidget = new ColorWidgetWithLabel( QString::number( i ), i );
colorWidget->setValue( m_colormap.get( i ).color );
connect( colorWidget, SIGNAL( colorChanged( QColor, int ) ), this, SLOT( colorChanged( QColor, int ) ) );
hLayout4->addWidget( colorWidget );
vLayout->addLayout( hLayout4 );
//.........这里部分代码省略.........
示例9: main
int main(int argc, char** argv)
{
// Check config option, if showing is disabled, exit
Fl_Config conf("EDE Team", "etip");
if(argc == 2 && (!strcmp(argv[1], "-f") || !strcmp(argv[1], "--force")))
{
// nothing, to simplify omiting those '!'
}
else
{
bool show = true;
conf.set_section("Tips");
conf.read("Show", show, true);
if (!show)
return 0;
}
conf_global = &conf;
srand(time(NULL));
fl_init_locale_support("etip", PREFIX"/share/locale");
Fl_Window* win = new Fl_Window(420, 169, _("Tips..."));
win->shortcut(0xff1b);
win->begin();
Fl_Group* gr = new Fl_Group(5, 5, 410, 130);
gr->box(FL_DOWN_BOX);
Fl_Box* img = new Fl_Box(5, 5, 70, 65);
Fl_Image pix(hint_xpm);
img->image(pix);
Fl_Box* title = new Fl_Box(80, 10, 320, 25, random_txt(title_tips, TITLE_TIPS_NUM));
title->label_font(fl_fonts+1);
title->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
title->box(FL_FLAT_BOX);
Fl_Box* tiptxt = new Fl_Box(80, 45, 320, 75, random_txt(tiplist, TIPS_NUM));
tiptxt->align(FL_ALIGN_LEFT|FL_ALIGN_TOP|FL_ALIGN_INSIDE|FL_ALIGN_WRAP);
tiptxt->box(FL_FLAT_BOX);
gr->end();
Fl_Check_Button* ch = new Fl_Check_Button(5, 140, 150, 25, _(" Do not bother me"));
show_check = ch;
Fl_Button* prev = new Fl_Button(160, 140, 80, 25, "<-");
prev->label_font(fl_fonts+1);
prev->callback(prev_cb, tiptxt);
Fl_Button* next = new Fl_Button(245, 140, 80, 25, "->");
next->label_font(fl_fonts+1);
next->callback(next_cb, tiptxt);
Fl_Button* close = new Fl_Button(335, 140, 80, 25, _("&Close"));
close->callback(close_cb, win);
win->end();
win->set_modal();
win->show();
return Fl::run();
}
示例10: pix
void MusicDesktopWallpaperWidget::show()
{
QPixmap pix(M_BACKGROUND_PTR->getMBackground());
ui->background->setPixmap(pix.scaled( size() ));
MusicAbstractMoveWidget::show();
}
示例11: Start
void MapRenderer::render(
QPainter* P,
QMap<RenderPriority, QSet <Feature*> > theFeatures,
const RendererOptions& options,
MapView* aView
)
{
#ifndef NDEBUG
QTime Start(QTime::currentTime());
#endif
theView = aView;
theOptions = options;
QMap<RenderPriority, QSet<Feature*> >::const_iterator itm;
QSet<Feature*>::const_iterator it;
bool bgLayerVisible = TEST_RFLAGS(RendererOptions::BackgroundVisible);
bool fgLayerVisible = TEST_RFLAGS(RendererOptions::ForegroundVisible);
bool tchpLayerVisible = TEST_RFLAGS(RendererOptions::TouchupVisible);
bool lblLayerVisible = TEST_RFLAGS(RendererOptions::NamesVisible);
Way * R = NULL;
Node * Pt = NULL;
Relation * RR = NULL;
QPixmap pix(theView->size());
thePainter = new QPainter();
itm = theFeatures.constBegin();
while (itm != theFeatures.constEnd())
{
pix.fill(Qt::transparent);
thePainter->begin(&pix);
if (M_PREFS->getUseAntiAlias())
thePainter->setRenderHint(QPainter::Antialiasing);
int curLayer = (itm.key()).layer();
while (itm != theFeatures.constEnd() && (itm.key()).layer() == curLayer)
{
for (it = itm.value().constBegin(); it != itm.value().constEnd(); ++it)
{
qreal alpha = (*it)->getAlpha();
thePainter->setOpacity(alpha);
R = NULL;
Pt = NULL;
RR = NULL;
if (!(R = CAST_WAY(*it)))
if (!(Pt = CAST_NODE(*it)))
RR = CAST_RELATION(*it);
if (R) {
// If there is painter at the relation level, don't paint at the way level
bool draw = true;
for (int i=0; i<R->sizeParents(); ++i) {
if (!R->getParent(i)->isDeleted() && R->getParent(i)->hasPainter(PixelPerM))
draw = false;
}
if (!draw)
continue;
}
if (!Pt) {
if (bgLayerVisible)
{
thePainter->save();
if (R && R->area() == 0)
thePainter->setCompositionMode(QPainter::CompositionMode_DestinationOver);
if (R)
bglayer.draw(R);
else if (Pt)
bglayer.draw(Pt);
else if (RR)
bglayer.draw(RR);
thePainter->restore();
}
if (fgLayerVisible)
{
thePainter->save();
if (R)
fglayer.draw(R);
else if (Pt)
fglayer.draw(Pt);
else if (RR)
fglayer.draw(RR);
thePainter->restore();
}
}
if (tchpLayerVisible)
{
thePainter->save();
if (R)
tchuplayer.draw(R);
else if (Pt)
//.........这里部分代码省略.........
示例12: pix
QPixmap Widget::getStatusIconPixmap(Status status, uint32_t w, uint32_t h)
{
QPixmap pix(w, h);
pix.load(getStatusIconPath(status));
return pix;
}
示例13: QWidget
//.........这里部分代码省略.........
m_align_center_action = createAction(QIcon(m_theme +"img16/edit_text_center.png"), tr("Centro"), true, grp);
m_align_right_action = createAction(QIcon(m_theme +"img16/edit_text_right.png"), tr("Derecho"), true, grp);
} else {
m_align_right_action = createAction(QIcon(m_theme +"img16/edit_text_right.png"), tr("Derecho"), true, grp);
m_align_center_action = createAction(QIcon(m_theme +"img16/edit_text_center.png"), tr("Centro"), true, grp);
m_align_left_action = createAction(QIcon(m_theme +"img16/edit_text_left.png"), tr("Izquierdo"), true, grp);
}
m_align_justify_action = createAction(QIcon(m_theme +"img16/edit_text_justify.png"), tr("Justificado"), true, grp);
m_align_left_action->setPriority(QAction::LowPriority);
m_align_left_action->setShortcut(Qt::CTRL + Qt::Key_L);
m_align_center_action->setPriority(QAction::LowPriority);
m_align_center_action->setShortcut(Qt::CTRL + Qt::Key_E);
m_align_right_action->setPriority(QAction::LowPriority);
m_align_right_action->setShortcut(Qt::CTRL + Qt::Key_R);
m_align_justify_action->setPriority(QAction::LowPriority);
m_align_justify_action->setShortcut(Qt::CTRL + Qt::Key_J);
toolbar_edit->addActions(grp->actions());
toolbar_edit->addSeparator();
// superscript, subscript
m_valign_sup_action = createAction(QIcon(m_theme +"img16/edit_text_super.png"), tr("Superíndice"), true, toolbar_edit);
connect(m_valign_sup_action, SIGNAL(triggered(bool)), this, SLOT(on_edit_valign_sup()));
toolbar_edit->addAction(m_valign_sup_action);
m_valign_sub_action = createAction(QIcon(m_theme +"img16/edit_text_subs.png"), tr("Subíndice"), true, toolbar_edit);
connect(m_valign_sub_action, SIGNAL(triggered(bool)), this, SLOT(on_edit_valign_sub()));
toolbar_edit->addAction(m_valign_sub_action);
toolbar_edit->addSeparator();
// image, link, color, simplify
m_image_action = createAction(QIcon(m_theme +"img16/edit_imagen.png"), tr("Imagen"), false, toolbar_edit);
connect(m_image_action, SIGNAL(triggered()), this, SLOT(on_edit_image()));
toolbar_edit->addAction(m_image_action);
m_link_action = createAction(QIcon(m_theme +"img16/edit_enlace.png"), tr("Enlace"), true, toolbar_edit);
connect(m_link_action, SIGNAL(triggered(bool)), this, SLOT(on_edit_link(bool)));
toolbar_edit->addAction(m_link_action);
QPixmap pix(16, 16);
pix.fill(Qt::black);
m_color_action = createAction(QIcon(pix), tr("Color") +"...", false, toolbar_edit);
connect(m_color_action, SIGNAL(triggered()), this, SLOT(on_edit_color()));
toolbar_edit->addAction(m_color_action);
toolbar_edit->addSeparator();
m_simplify_richtext_action = createAction(QIcon(m_theme +"img16/edit_simplify_richtext.png"), tr("Simplificar") +" Html", true, toolbar_edit);
m_simplify_richtext_action->setChecked(editor_rich_text->simplifyRichText());
connect(m_simplify_richtext_action, SIGNAL(triggered(bool)), editor_rich_text, SLOT(setSimplifyRichText(bool)));
connect(editor_rich_text, SIGNAL(simplifyRichTextChanged(bool)), m_simplify_richtext_action, SLOT(setChecked(bool)));
toolbar_edit->addAction(m_simplify_richtext_action);
toolbar_layout->addWidget(toolbar_edit);
QToolBar *toolbar_opts = new QToolBar(this);
toolbar_opts->setIconSize(QSize(20, 20));
toolbar_opts->setMinimumSize(QSize(30, 30));
toolbar_opts->setStyleSheet("QToolBar{border:0px;}");
m_find_replace_text_action = createAction(QIcon(m_theme +"img16/edit_buscar.png"), tr("Buscar") +"/"+ tr("Reemplazar"), true, toolbar_opts);
m_find_replace_text_action->setPriority(QAction::LowPriority);
m_find_replace_text_action->setShortcut(QKeySequence::Find);
connect(m_find_replace_text_action, SIGNAL(triggered(bool)), this, SLOT(on_show_find_replace(bool)));
toolbar_opts->addAction(m_find_replace_text_action);
m_rich_plain_action = createAction(QIcon(m_theme +"img16/script.png"), tr("Editor") +"/"+ tr("Código"), true, toolbar_opts);
connect(m_rich_plain_action, SIGNAL(triggered(bool)), this, SLOT(on_show_source(bool)));
toolbar_opts->addAction(m_rich_plain_action);
m_smiles_action = createAction(QIcon(m_theme +"img16/smile.png"), tr("Smiles"), true, toolbar_opts);
connect(m_smiles_action, SIGNAL(triggered(bool)), list_smile, SLOT(setVisible(bool)));
toolbar_opts->addAction(m_smiles_action);
toolbar_layout->addWidget(toolbar_opts);
toolbar_layout->setStretch(0, 1);
示例14: AbstractItemView
InputWidget::InputWidget(QWidget *parent)
: AbstractItemView(parent),
_networkId(0)
{
ui.setupUi(this);
connect(ui.ownNick, SIGNAL(activated(QString)), this, SLOT(changeNick(QString)));
layout()->setAlignment(ui.ownNick, Qt::AlignBottom);
layout()->setAlignment(ui.inputEdit, Qt::AlignBottom);
layout()->setAlignment(ui.showStyleButton, Qt::AlignBottom);
layout()->setAlignment(ui.styleFrame, Qt::AlignBottom);
ui.styleFrame->setVisible(false);
setFocusProxy(ui.inputEdit);
ui.ownNick->setFocusProxy(ui.inputEdit);
ui.ownNick->setSizeAdjustPolicy(QComboBox::AdjustToContents);
ui.ownNick->installEventFilter(new MouseWheelFilter(this));
ui.inputEdit->installEventFilter(this);
ui.inputEdit->setMinHeight(1);
ui.inputEdit->setMaxHeight(5);
ui.inputEdit->setMode(MultiLineEdit::MultiLine);
ui.inputEdit->setPasteProtectionEnabled(true);
ui.boldButton->setIcon(SmallIcon("format-text-bold"));
ui.italicButton->setIcon(SmallIcon("format-text-italic"));
ui.underlineButton->setIcon(SmallIcon("format-text-underline"));
ui.textcolorButton->setIcon(SmallIcon("format-text-color"));
ui.highlightcolorButton->setIcon(SmallIcon("format-fill-color"));
ui.encryptionIconLabel->hide();
_colorMenu = new QMenu();
_colorFillMenu = new QMenu();
QStringList names;
names << tr("White") << tr("Black") << tr("Dark blue") << tr("Dark green") << tr("Red") << tr("Dark red") << tr("Dark magenta") << tr("Orange")
<< tr("Yellow") << tr("Green") << tr("Dark cyan") << tr("Cyan") << tr("Blue") << tr("Magenta") << tr("Dark gray") << tr("Light gray");
QPixmap pix(16, 16);
for (int i = 0; i < inputLine()->mircColorMap().count(); i++) {
pix.fill(inputLine()->mircColorMap().values()[i]);
_colorMenu->addAction(pix, names[i])->setData(inputLine()->mircColorMap().keys()[i]);
_colorFillMenu->addAction(pix, names[i])->setData(inputLine()->mircColorMap().keys()[i]);
}
pix.fill(Qt::transparent);
_colorMenu->addAction(pix, tr("Clear Color"))->setData("");
_colorFillMenu->addAction(pix, tr("Clear Color"))->setData("");
ui.textcolorButton->setMenu(_colorMenu);
connect(_colorMenu, SIGNAL(triggered(QAction *)), this, SLOT(colorChosen(QAction *)));
ui.highlightcolorButton->setMenu(_colorFillMenu);
connect(_colorFillMenu, SIGNAL(triggered(QAction *)), this, SLOT(colorHighlightChosen(QAction *)));
new TabCompleter(ui.inputEdit);
UiStyleSettings fs("Fonts");
fs.notify("UseCustomInputWidgetFont", this, SLOT(setUseCustomFont(QVariant)));
fs.notify("InputWidget", this, SLOT(setCustomFont(QVariant)));
if (fs.value("UseCustomInputWidgetFont", false).toBool())
setCustomFont(fs.value("InputWidget", QFont()));
UiSettings s("InputWidget");
#ifdef HAVE_KDE
s.notify("EnableSpellCheck", this, SLOT(setEnableSpellCheck(QVariant)));
setEnableSpellCheck(s.value("EnableSpellCheck", false));
#endif
s.notify("EnableEmacsMode", this, SLOT(setEnableEmacsMode(QVariant)));
setEnableEmacsMode(s.value("EnableEmacsMode", false));
s.notify("ShowNickSelector", this, SLOT(setShowNickSelector(QVariant)));
setShowNickSelector(s.value("ShowNickSelector", true));
s.notify("ShowStyleButtons", this, SLOT(setShowStyleButtons(QVariant)));
setShowStyleButtons(s.value("ShowStyleButtons", true));
s.notify("EnablePerChatHistory", this, SLOT(setEnablePerChatHistory(QVariant)));
setEnablePerChatHistory(s.value("EnablePerChatHistory", false));
s.notify("MaxNumLines", this, SLOT(setMaxLines(QVariant)));
setMaxLines(s.value("MaxNumLines", 5));
s.notify("EnableScrollBars", this, SLOT(setScrollBarsEnabled(QVariant)));
setScrollBarsEnabled(s.value("EnableScrollBars", true));
s.notify("EnableMultiLine", this, SLOT(setMultiLineEnabled(QVariant)));
setMultiLineEnabled(s.value("EnableMultiLine", true));
ActionCollection *coll = QtUi::actionCollection();
Action *activateInputline = coll->add<Action>("FocusInputLine");
connect(activateInputline, SIGNAL(triggered()), SLOT(setFocus()));
activateInputline->setText(tr("Focus Input Line"));
activateInputline->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_L));
connect(inputLine(), SIGNAL(textEntered(QString)), SLOT(onTextEntered(QString)), Qt::QueuedConnection); // make sure the line is already reset, bug #984
//.........这里部分代码省略.........
示例15: pix
void EditorWidget::colorChanged(const QColor &c)
{
QPixmap pix(16, 16);
pix.fill(c);
m_color_action->setIcon(QIcon(pix));
}